matlab求解非线性方程命令,matlab求解非线性方程组命令用法

1.方程组的有解性2.方程组解是否唯一3.x0的选取,如果解不唯一,不同的x0可能会得到不同的解fsolve -

Solve system of nonlinear

equationsEquation

Solves a problem specified by

F(x) = 0

for x, where x is a vector and

F(x) is a function that returns a vector

value.

Syntax

x = fsolve(fun,x0)

x = fsolve(fun,x0,options)

x = fsolve(problem)

[x,fval] = fsolve(fun,x0)

[x,fval,exitflag] = fsolve(...)

[x,fval,exitflag,output] = fsolve(...)

[x,fval,exitflag,output,jacobian] = fsolve(...)

Description

fsolve finds a root (zero) of a system of nonlinear

equations.

x = fsolve(fun,x0) starts at x0 and tries to

solve the equations described in fun.

x = fsolve(fun,x0,options) solves the equations with

the optimization options specified in the structure

options. Use optimset to set these options.

x = fsolve(problem) solves problem, where

problem is a structure described in Input Arguments.

Create the structure problem by exporting a problem

from Optimization Tool, as described in Exporting to the MATLAB®

Workspace.

[x,fval] = fsolve(fun,x0) returns the value of the

objective function fun at the solution x.

[x,fval,exitflag] = fsolve(...) returns a value

exitflag that describes the exit condition.

[x,fval,exitflag,output] = fsolve(...) returns a

structure output that contains information about the

optimization.

[x,fval,exitflag,output,jacobian] = fsolve(...) returns

the Jacobian of fun at the solution x.

Passing Extra Parameters

explains how to parameterize the objective function fun,

if necessary.

Input Arguments

Function Arguments contains

general descriptions of arguments passed into fsolve. This

section provides function-specific details for fun and

problem:

fun

The nonlinear system of equations to solve. fun is a

function that accepts a vector x and returns a vector

F, the nonlinear equations evaluated at x. The

function fun can be specified as a function handle for an

M-file function

x = fsolve(@myfun,x0)

where myfun is a MATLAB® function such

as

function F = myfun(x)

F = ... % Compute function values at x

fun can also be a function handle for an anonymous

function.

x = fsolve(@(x)sin(x.*x),x0);

If the user-defined values for x and F are

matrices, they are converted to a vector using linear indexing.

If the Jacobian can also be computed and

the Jacobian option is 'on', set by

options = optimset('Jacobian','on')

then the function fun must return, in a second output

argument, the Jacobian value J, a matrix, at

x.

If fun returns a vector (matrix) of m

components and x has length n, where n

is the length of x0, then the Jacobian J is an

m-by-n matrix where J(i,j) is the

partial derivative of F(i) with respect to x(j).

(Note that the Jacobian J is the transpose of the gradient

of F.)

problem

objective

Objective function

x0

Initial point for x

solver

'fsolve'

options

Options structure created with optimset

Output Arguments

Function Arguments contains

general descriptions of arguments returned by fsolve. For

more information on the output headings for fsolve, see

Function-Specific Output

Headings.

This section provides function-specific details for

exitflag and output:

exitflag

Integer identifying the reason the algorithm terminated. The

following lists the values of exitflag and the

corresponding reasons the algorithm terminated.

1

Function converged to a solution x.

2

Change in x was smaller than the specified

tolerance.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值