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

8 次查看(过去 30 天)
mixig
mixig 2022-11-23
回答: tidot 2022-11-23
%% 控制算法确定控制参数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为一个循环的变量。这样求不出来,请问各位有没有知道怎么用的。

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 数学 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!