我试图用ODE45求解常微分方程,但是我得到以下错误。我已经尽力调试程序,但错误仍然存在。任何帮助将不胜感激
function dp = suspension_seat_z_model_1(t,p,cushion_interface_vel_z,cushion_interface_dis_z)
load('C:\Users\Jay\Desktop\Program - Post Processing\model_mfiles\resample_filter_add_1s.mat','cushion_interface_acc_z','cushion_interface_dis_z','cushion_interface_vel_z','ts1')
V = cushion_interface_vel_z;
D = cushion_interface_dis_z;
% define constant parameters
mh1=13.9; % lower part of the dummy (kg)
mh2=47.9; % upper part of the dummy (kg)
ch=1100; % damping_co-efficient_dummy (Ns/m)
kh=42000; % stiffness_co-efficient_dummy (N/m)
kcz=35000; % spring_stiffness_cushion (N/m)
ccz=1500; % damping_co-efficient_cushion (Ns/m)
dp=zeros(4,1);
dp(1)=p(2);
dp(3)=p(4);
dp(4)=((kh/mh2)*(p(1)-p(3)))+((ch/mh2)*(p(2)-p(4)));
dp(2)=((kcz/mh1)*(D-p(1)))-((kh/mh1)*(p(1)-p(3)))+((ccz/mh1)*(V-p(2)))-((ch/mh1)*(p(2)-p(4)));
end
错误消息
[T P] = ode45(@(t,p)suspension_seat_z_model_1(t,p,cushion_interface_vel_z,cushion_interface_dis_z),[0 305],[0 0 0 0]') 在赋值A(I)= B中,B和I中的元素数必须相同。
suspension_seat_z_model_1(第26行)出错 DP(2)=((KCZ / MH1)(DP(1))) - ((KH / MH1)(P(1)-p(3)))+((CCZ / MH1 )(VP(2))) - ((CH / MH1)(p(2)-P(4)));
中的错误@(t,p)suspension_seat_z_model_1(t,p,cushion_interface_vel_z,cushion_interface_dis_z)
odearguments中的错误(第88行) f0 = feval(ode,t0,y0,args {:}); %ODE15I将args {1}设置为yp0。
ode45错误(第114行) [neq,tspan,ntspan,next,t0,tfinal,tdir,y0,f0,odeArgs,odeFcn,...