# 线性最小二乘

## 函数

 `evaluate` 计算优化表达式 `infeasibility` 一个点处的约束违反度 `optimproblem` 创建优化问题 `optimvar` 创建优化变量 `solve` 求解优化问题或方程问题
 `lsqlin` 求解约束线性最小二乘问题 `lsqnonneg` 求解非负线性最小二乘问题 `mldivide, \` 求解关于 x 的线性方程组 Ax = B `optimwarmstart` Create warm start object

## 实时编辑器任务

 优化 在实时编辑器中优化或求解方程

## 主题

### 基于问题的线性最小二乘

Shortest Distance to a Plane

Shows how to solve a linear least-squares problem using the problem-based approach.

Nonnegative Linear Least Squares, Problem-Based

Shows how to solve a nonnegative linear least-squares problem using the problem-based approach and several solvers.

Large-Scale Constrained Linear Least-Squares, Problem-Based

Solves an optical deblurring problem using the problem-based approach.

Write Objective Function for Problem-Based Least Squares

Syntax rules for problem-based least squares.

### 基于求解器的线性最小二乘

Optimize Live Editor Task with lsqlin Solver

Example showing the Optimize Live Editor task and linear least squares.

Nonnegative Linear Least Squares, Solver-Based

This example shows how to use several algorithms to solve a linear least-squares problem with the bound constraint that the solution is nonnegative.

Jacobian Multiply Function with Linear Least Squares

Example showing how to save memory in a large structured linear least-squares problem.

Warm Start Best Practices

Describes how best to use warm start for speeding repeated solutions.

Large-Scale Constrained Linear Least-Squares, Solver-Based

Solves an optical deblurring problem using the solver-based approach.

### 代码生成

Code Generation in Linear Least Squares: Background

Prerequisites to generate C code for linear least squares.

Generate Code for lsqlin

Example of code generation for linear least squares.

Optimization Code Generation for Real-Time Applications

Explore techniques for handling real-time requirements in generated code.

### 基于问题的算法

Write Objective Function for Problem-Based Least Squares

Syntax rules for problem-based least squares.

Supported Operations for Optimization Variables and Expressions

Explore the supported mathematical and indexing operations for optimization variables and expressions.