非线性方程组
以串行或并行方式求解非线性方程组
求多变量非线性方程 F(x) = 0 的解。您也可以使用基于问题的方法求解标量方程或线性方程组,或由 F(x) = G(x) 表示的方程组(等效于使用基于求解器的方法求解 F(x) – G(x) = 0)。对于非线性方程组,求解器将方程求解问题转换为最小化 F 的分量平方和的优化问题,即 min(∑Fi2(x))。线性方程和标量方程有不同的求解算法;请参阅方程求解算法。
在开始求解优化问题之前,您必须选择合适的方法:基于问题或基于求解器。有关详细信息,请参阅首先选择基于问题或基于求解器的方法。
对于基于问题的方法,请创建问题变量,然后用这些变量表示方程。有关基于问题的求解步骤,请参阅基于问题的方程求解工作流。要求解生成的问题,请使用 solve
。
有关基于求解器的求解步骤,包括定义目标函数和选择合适的求解器,请参阅基于求解器的优化问题设置。
函数
实时编辑器任务
优化 | 在实时编辑器中优化或求解方程 (自 R2020b 起) |
对象
EquationProblem | 非线性方程组 (自 R2019b 起) |
OptimizationEquality | 等式和等式约束 (自 R2019b 起) |
OptimizationExpression | 关于优化变量的算术或函数表达式 |
OptimizationVariable | 优化变量 |
主题
基于问题的非线性方程组
- 基于问题求解非线性方程组
使用基于问题的方法求解非线性方程组。 - 基于问题求解多项式非线性方程组
使用基于问题的方法求解多项式方程组。 - Follow Equation Solution as a Parameter Changes
Solve a sequence of problems using the previous solution as a start point. - Nonlinear System of Equations with Constraints, Problem-Based
Solve a system of nonlinear equations with constraints using the problem-based approach.
基于求解器的非线性方程组
- 求解不含和含雅可比矩阵的非线性方程组
在非线性方程求解中使用导数。 - Large System of Nonlinear Equations with Jacobian Sparsity Pattern
Solve a nonlinear system of equations with a known finite-difference sparsity pattern. - Large Sparse System of Nonlinear Equations with Jacobian
Example of solving a nonlinear system of equations that has derivatives available. - 带约束的非线性方程组
了解求解具有约束的非线性方程组的方法。
代码生成
- 非线性方程求解中的代码生成:背景
为非线性方程组生成 C 代码的前提条件。 - 为 fsolve 生成代码
求解非线性方程组的代码生成示例。 - Optimization Code Generation for Real-Time Applications
Explore techniques for handling real-time requirements in generated code.
并行计算
- What Is Parallel Computing in Optimization Toolbox?
Use multiple processors for optimization. - Using Parallel Computing in Optimization Toolbox
Perform gradient estimation in parallel. - Improving Performance with Parallel Computing
Investigate factors for speeding optimizations.