请教:解非线性方程组(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!