Main Content

本页对应的英文页面已更新,但尚未翻译。 若要查看最新内容,请点击此处访问英文页面。

线性最小二乘

求解具有边界或线性约束的线性最小二乘问题

在开始求解优化问题之前,您必须选择合适的方法:基于问题或基于求解器。有关详细信息,请参阅 首先选择基于问题或基于求解器的方法

线性最小二乘求解 min||C*x - d||2,可能有边界或线性约束。

对于基于问题的方法,请创建问题变量,然后用这些符号变量表示目标函数和约束。有关基于问题的求解步骤,请参阅Problem-Based Optimization Workflow。要求解生成的问题,请使用 solve

有关基于求解器的求解步骤,包括定义目标函数和约束,以及选择合适的求解器,请参阅基于求解器的优化问题设置。要求解生成的问题,请使用 lsqlin;或者,对于非负最小二乘,也可以使用 lsqnonneg

函数

全部展开

evaluateEvaluate optimization expression
infeasibilityConstraint violation at a point
optimproblem创建优化问题
optimvarCreate optimization variables
solve求解优化问题或方程问题
lsqlin求解约束线性最小二乘问题
lsqnonneg求解非负线性最小二乘问题
mldivide, \对线性方程组 Ax = B 求解 x

主题

基于问题的线性最小二乘

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.

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

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.

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

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

基于问题的算法

Write Objective Function for Problem-Based Least Squares

Syntax rules for problem-based least squares.

Problem-Based Optimization Algorithms

How the optimization functions and objects solve optimization problems.

Supported Operations on Optimization Variables and Expressions

Lists all available mathematical and indexing operations on optimization variables and expressions.

算法和选项

最小二乘(模型拟合)算法

在仅具有边界或线性约束的情况下,在 n 个维度中最小化平方和。

优化选项参考

了解优化选项。