请教:解非线性方程组(fsolve)。

8 views (last 30 days)
mixig
mixig on 23 Nov 2022
Answered: tidot on 23 Nov 2022
%% 控制算法确定控制参数tao
clear all
clc
alpha0=0;
rou0=20/180*pi;
syms thetax tao;
options=optimset('TolFun',1e-8);
F=@(thetaA,thetaB)[sin(rou)*cos(tao)+0.5*sin(thetaA)*(1-cos(thetaB))-(sqrt(2)/2)*cos(thetaA)*sin(thetaB);
cos(alpha0)*sin(rou)*sin(tao)+sin(alpha0)*cos(rou)-0.5*cos(thetaA)*(1-cos(thetaB))-(sqrt(2)/2)*sin(thetaA)*sin(thetaB)];
for tao0=0:4*pi/360:pi
theta0=[0;0];
[theta,fval]=fsolve(@myfun,theta0,options);
end
%%%请教各位大侠,我想用fsolve解一个非线性方程组(或者各位有更好的函数解法),其中thetaA和thetaB为要求的量。其他如alpha0,rou为已知量。tao为一个循环的变量。这样求不出来,请问各位有没有知道怎么用的。

Accepted Answer

tidot
tidot on 23 Nov 2022
可以求解
首先你的函数需要用m文件定义
其次fsolve传递参数的时候,常量放在fsolve末尾
基于此,我重写了一下你的问题求解程序,见附件
[attach]128480[/attach][attach]128481[/attach]

More Answers (0)

Categories

Find more on 数学 in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!