PDA

查看完整版本 : 如何调用fzero函数求角theta3对应于theta1的各个值?


Lixiney
2009-04-12, 10:22
如题已知: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
theta3(1)=fzero('h',theta3)-----这个语句中theta3没有定义!
不仅theta3没有定义,theta1也没有定义。。。。。。。
你的语句有不少问题。

Lixiney
2009-04-12, 22:18
theta3(1)=fzero('h',theta3)-----这个语句中theta3没有定义!
不仅theta3没有定义,theta1也没有定义。。。。。。。
你的语句有不少问题。

那怎么定义吖?:confused: