MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   物理学 (https://www.labfans.com/bbs/forumdisplay.php?f=60)
-   -   如何调用fzero函数求角theta3对应于theta1的各个值? (https://www.labfans.com/bbs/showthread.php?t=7634)

Lixiney 2009-04-12 10:22

如何调用fzero函数求角theta3对应于theta1的各个值?
 
如题已知:L1=70;L2=130;L3=90;L4=150;w1=70;角thta1=th1;角theta3=x,x为所求;

我编的程序为:
th1=theta1(1);theta3(1)=fzero('h',theta3);%求初始输出theta3
for i=2:181
th1=theta1(i);
theta3(i)=fzero('h',theta3(i-1));%调用fzero逐次求theta3
end


调用的子程序为:

function y=h(x)
global L1 L2 L3 L4 th1
y=L1*cos(th1)+L2*sqrt(1-(L3*sin(x)-L1*sin(th1)).^2/L2/L2- ...
L3*cos(x)-L4;


不知是哪一步出错了,老是说角theta3未定义,请高手帮忙!:confused:

mathjiang 2009-04-12 21:46

回复: 急,如何调用fzero函数求角theta3对应于theta1的各个值?
 
theta3(1)=fzero('h',theta3)-----这个语句中theta3没有定义!
不仅theta3没有定义,theta1也没有定义。。。。。。。
你的语句有不少问题。

Lixiney 2009-04-12 22:18

回复: 急,如何调用fzero函数求角theta3对应于theta1的各个值?
 
[QUOTE=mathjiang;25796]theta3(1)=fzero('h',theta3)-----这个语句中theta3没有定义!
不仅theta3没有定义,theta1也没有定义。。。。。。。
你的语句有不少问题。[/QUOTE]

那怎么定义吖?:confused:


所有时间均为北京时间。现在的时间是 05:18

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.