大神求救有关matlab 递推公式!function result=pintaun(theta,alpha)n_stop=fun_nstop(alpha);pi(1)=0;pi(2)=1;for n=3:n_stoppi(n)=(2*n-1)*cos(theta)*pi(n-1)/(n-1)-n*p1(n-2)/(n-1);tau(n)=n*cos(theta)*pi(n)-(n+1)*pi(n-1);end;pi(n)=pi(n-1);tau(n)=ta
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/29 12:44:28
![大神求救有关matlab 递推公式!function result=pintaun(theta,alpha)n_stop=fun_nstop(alpha);pi(1)=0;pi(2)=1;for n=3:n_stoppi(n)=(2*n-1)*cos(theta)*pi(n-1)/(n-1)-n*p1(n-2)/(n-1);tau(n)=n*cos(theta)*pi(n)-(n+1)*pi(n-1);end;pi(n)=pi(n-1);tau(n)=ta](/uploads/image/z/5250636-36-6.jpg?t=%E5%A4%A7%E7%A5%9E%E6%B1%82%E6%95%91%E6%9C%89%E5%85%B3matlab+%E9%80%92%E6%8E%A8%E5%85%AC%E5%BC%8F%21function+result%3Dpintaun%28theta%2Calpha%29n_stop%3Dfun_nstop%28alpha%29%3Bpi%281%29%3D0%3Bpi%282%29%3D1%3Bfor+n%3D3%3An_stoppi%28n%29%3D%282%2An-1%29%2Acos%28theta%29%2Api%28n-1%29%2F%28n-1%29-n%2Ap1%28n-2%29%2F%28n-1%29%3Btau%28n%29%3Dn%2Acos%28theta%29%2Api%28n%29-%28n%2B1%29%2Api%28n-1%29%3Bend%3Bpi%28n%29%3Dpi%28n-1%29%3Btau%28n%29%3Dta)
大神求救有关matlab 递推公式!function result=pintaun(theta,alpha)n_stop=fun_nstop(alpha);pi(1)=0;pi(2)=1;for n=3:n_stoppi(n)=(2*n-1)*cos(theta)*pi(n-1)/(n-1)-n*p1(n-2)/(n-1);tau(n)=n*cos(theta)*pi(n)-(n+1)*pi(n-1);end;pi(n)=pi(n-1);tau(n)=ta
大神求救有关matlab 递推公式!
function result=pintaun(theta,alpha)
n_stop=fun_nstop(alpha);
pi(1)=0;
pi(2)=1;
for n=3:n_stop
pi(n)=(2*n-1)*cos(theta)*pi(n-1)/(n-1)-n*p1(n-2)/(n-1);
tau(n)=n*cos(theta)*pi(n)-(n+1)*pi(n-1);
end;
pi(n)=pi(n-1);
tau(n)=tau(n-1);
result=[pi(n),tau(n)];
我是菜鸟,这个程序为什么是错的啊?
(n_stop=fun_nstop(alpha);这个有子程序且无错)
matlab提示错误:
>> result=pintaun(0.5,5)?Undefined function or method 'p1' for input arguments of type 'double'.
Error in ==> pintaun at 6
pi(n)=(2*n-1)*cos(theta)*pi(n-1)/(n-1)-n*p1(n-2)/(n-1);
大神求救有关matlab 递推公式!function result=pintaun(theta,alpha)n_stop=fun_nstop(alpha);pi(1)=0;pi(2)=1;for n=3:n_stoppi(n)=(2*n-1)*cos(theta)*pi(n-1)/(n-1)-n*p1(n-2)/(n-1);tau(n)=n*cos(theta)*pi(n)-(n+1)*pi(n-1);end;pi(n)=pi(n-1);tau(n)=ta
出错的地方电脑都告诉你了,就是这个
pi(n)=(2*n-1)*cos(theta)*pi(n-1)/(n-1)-n*p1(n-2)/(n-1);
这里面最后一项里的p1没有定义,要不就是你把pi输成了p1.