yinhexly 发表于 2007-1-24 22:04

程序求解求助

主程序:
clear;
=ode45(@yinhexly,,);
figure(1),plot(t,y(:,1))
figure(2),plot(t,y(:,5))

子程序:
function z=yinhexly(t,y)
z=zeros(8,1);
z(1)=y(2);
z(2)=1/7.76*(-360*(y(2)+71.42*y(4)-y(6)+103.55*y(8)-0.263*(43.15*cos(43.15*t)-11.66*sin(11.66*t)))-122.79*y(2)-13152.89*(y(1)+71.42*y(3)-y(5)+103.55*y(7)-0.263*(sin(43.15*t)+cos(11.66*t)))-5737.91*y(1));
z(3)=y(4);
z(4)=1/47576*(-71.42*(360*(y(2)+71.42*y(4)-y(6)+103.55*y(8)-0.263*(43.15*cos(43.15*t)-11.66*sin(11.66*t)))+13152.89*(y(1)+71.42*y(3)-y(5)+103.55*y(7)-0.263*(sin(43.15*t)+cos(11.66*t)))-3474747+165*sin(40.3/180)));
z(5)=y(6);
z(6)=1/16.65*(360*(y(2)+71.42*y(4)-y(6)+103.55*y(8)-0.263*(43.15*cos(43.15*t)-11.66*sin(11.66*t)))-122.79*y(6)+13152.89*(y(1)+71.42*y(3)-y(5)+103.55*y(7)-0.263*(sin(43.15*t)+cos(11.66*t)))-6597.45*y(5));
z(7)=y(8);
z(8)=1/122754*(-71.42*(360*(y(2)+71.42*y(4)-y(6)+103.55*y(8)-0.263*(43.15*cos(43.15*t)-11.66*sin(11.66*t)))+13152.89*(y(1)+71.42*y(3)-y(5)+103.55*y(7)-0.263*(sin(43.15*t)+cos(11.66*t)))-5027958+187*sin(27.8/180)));

我要y(1),y(5)的图解,但解不出来,求求帮帮忙!谢谢了!
yinhexly@163.com

[ 本帖最后由 mjhzhjg 于 2007-1-24 22:37 编辑 ]

xjzuo 发表于 2007-1-25 10:44

回复

运行了一下,好象并没有什么问题.
附图是图形,不知是否是你想要的效果.
%%%%%%%%%%main program%%%%%%%%%%%%
clear
=ode45(@yinhexly,,);
figure(1),plot(t,y(:,1),'b',t,y(:,5),'r')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%function
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function z=yinhexly(t,y)
z=zeros(8,1);
z(1)=y(2);
z(2)=1/7.76*(-360*(y(2)+71.42*y(4)-y(6)+103.55*y(8)-0.263*(43.15*cos(43.15*t)-11.66*sin(11.66*t)))-122.79*y(2)-13152.89*(y(1)+71.42*y(3)-y(5)+103.55*y(7)-0.263*(sin(43.15*t)+cos(11.66*t)))-5737.91*y(1));
z(3)=y(4);
z(4)=1/47576*(-71.42*(360*(y(2)+71.42*y(4)-y(6)+103.55*y(8)-0.263*(43.15*cos(43.15*t)-11.66*sin(11.66*t)))+13152.89*(y(1)+71.42*y(3)-y(5)+103.55*y(7)-0.263*(sin(43.15*t)+cos(11.66*t)))-3474747+165*sin(40.3/180)));
z(5)=y(6);
z(6)=1/16.65*(360*(y(2)+71.42*y(4)-y(6)+103.55*y(8)-0.263*(43.15*cos(43.15*t)-11.66*sin(11.66*t)))-122.79*y(6)+13152.89*(y(1)+71.42*y(3)-y(5)+103.55*y(7)-0.263*(sin(43.15*t)+cos(11.66*t)))-6597.45*y(5));
z(7)=y(8);
z(8)=1/122754*(-71.42*(360*(y(2)+71.42*y(4)-y(6)+103.55*y(8)-0.263*(43.15*cos(43.15*t)-11.66*sin(11.66*t)))+13152.89*(y(1)+71.42*y(3)-y(5)+103.55*y(7)-0.263*(sin(43.15*t)+cos(11.66*t)))-5027958+187*sin(27.8/180)));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
页: [1]
查看完整版本: 程序求解求助