|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
以前看过别人解微分方程组,但是关于t的函数,而我的这里T1,T2,T3,T4均为一些离散的数据点,我不知道这么用是否有问题
报错:
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, odeFcn, ...
m文件
function dy=vdp_eq(t,y,I1,I2,I3,I4,I5,I6,c1,c2,c3,c4,h1,h2,h3,h4,h5,k1,k2,k3,k4,k5,T1,T2,T3,T4)
f=[y(2);
[-h1*(y(2)-y(4))-k1*(y(1)-y(3))]/I1;
y(4);
[T1-h1*(y(4)-y(2))-h2*(y(4)-y(6))-c1*y(4)-k1*(y(3)-y(1))-k2*(y(3)-y(5))]/I2;
y(6);
[T2-h2*(y(6)-y(4))-h3*(y(6)-y(8))-c2*y(6)-k2*(y(5)-y(3))-k3*(y(5)-y(7))]/I3;
y(8);
[T3-h3*(y(8)-y(6))-h4*(y(8)-y(9))-c3*y(8)-k3*(y(7)-y(5))-k4*(y(7)-y(9))]/I4;
y(9);
[T4-h4*(y(10)-y(8))-h5*(y(10)-y(12))-c4*y(10)-k4*((9)-y(7))-k5*(y(9)-y(11))]/I5;
y(11);
[-h5*(y(12)-y(10))-k5*(y(11)-y(9))]/I6];
end
以上为m文件
I1=0.005;
I2=0.0092;
I3=0.0082;
I4=0.0082;
I5=0.0091;
I6=0.1533;
k1=86000;
k2=508100;
k3=518200;
k4=505100;
k5=767200;
c1=0;
c2=0;
c3=0;
c4=0;
c5=0;
h1=1;
h2=1;
h3=1;
h4=1;
h5=1;
fig=fopen('D:Ttqsor1.dat','r')
T1=fscanf(fig,'%f')
fclose(fig)
T1=T1(1:720)
fig=fopen('D:Ttqsor2.dat','r')
T2=fscanf(fig,'%f')
fclose(fig)
T2=T2(1:720)
fig=fopen('D:Ttqsor3.dat','r')
T3=fscanf(fig,'%f')
fclose(fig)
T3=T3(1:720)
fig=fopen('D:Ttqsor4.dat','r')
T4=fscanf(fig,'%f')
fclose(fig)
T4=T4(1:720);
t_tent=719;
options = odeset('RelTol',1e-4,'AbsTol',[1e-4]);
[t,y] = ode45(@vdp_eq,[0 t_tent],[0 100 0 100 0 100 0 100 0 100 0 100],options,I1,I2,I3,I4,I5,I6,c1,c2,c3,c4,h1,h2,h3,h4,h5,k1,k2,k3,k4,k5,T1,T2,T3,T4);
plot(t,y(:,1),'-',t,y(:,2),'-.',t,y(:,3),'.') |
-
|