hitzhjtopku
2008-09-04, 10:22
for i=1:30
a=0.03755;
g=9.8;
m=0.4387;
j1=0.25*m*a*a;
j2=j1;
j3=0.5*m*a*a;
y2(i)=pi/(6*i);
y3=2;w=(-j1*sin(y2(i))*cos(y2(i)));
b=((j3+m*a*a)*y3*sin(y2(i)));
c=m*g*a*cos(y2(i));
y1(i)=(-1*b+sqrt(b*b-4*w*c))/(2*w)
[t,y]=ode45('sanshi',[0:0.1:10],[y1(i)]);
plot(y2(i),y(i))
end
微分方程程序为:
function ydot=sanshi(t,y)
ydot=[y1];
运行后:提示为:y1 =
-39.28740909827422
??? Undefined function or variable 'y1'.
Error in ==> sanshi at 2
ydot=[y1];
Error in ==> funfun\private\odearguments at 110
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ==> ode45 at 173
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, ...
a=0.03755;
g=9.8;
m=0.4387;
j1=0.25*m*a*a;
j2=j1;
j3=0.5*m*a*a;
y2(i)=pi/(6*i);
y3=2;w=(-j1*sin(y2(i))*cos(y2(i)));
b=((j3+m*a*a)*y3*sin(y2(i)));
c=m*g*a*cos(y2(i));
y1(i)=(-1*b+sqrt(b*b-4*w*c))/(2*w)
[t,y]=ode45('sanshi',[0:0.1:10],[y1(i)]);
plot(y2(i),y(i))
end
微分方程程序为:
function ydot=sanshi(t,y)
ydot=[y1];
运行后:提示为:y1 =
-39.28740909827422
??? Undefined function or variable 'y1'.
Error in ==> sanshi at 2
ydot=[y1];
Error in ==> funfun\private\odearguments at 110
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ==> ode45 at 173
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, ...