Problema en ode45, no compila

Al compilar la función me aparece "Not enough input arguments."
Como puedo solucionarlo??
function dzdt=funciontp2(t,x)
m=53
Iy=144000
Sw=30
ST=7.5
s=7.5
c=4
Claw=4.5
ClaT=3.2
w=18
lw=0.6
lT=7
wg0=6.25
V=187.5
le=0.25
la=0.25
lwm=0.1
A=0.1
B=0
ke0=0.1396
Gamma_e0=0.0873
rho=0.784
aw=0.5*rho*V^2*Sw*Claw
aT=0.5*rho*V^2*ST*ClaT
l=lw+lT
t0=l/V
wgt=wg0
wgtlv=((t>0) & (t<t0)).*0 + (t>=t0).*wg0
dxdt1=x(2)
dxdt2=(-aw-aT)/(V*m)*x(2) + (aw*lw+aT*lT)/(V*m)* x(4) - (aw+aT)/(V*m)*x(3)- aw/V/m*wgt - aT/V/m*wgtlv
dxdt3=x(4)
dxdt4=(aw*lw-aT*lT)/V/Iy * x(2) + (aT*lT^2-aw*lw^2)/V/Iy * x(4) + (aw*lw-aT*lT)/V/Iy * x(3) + aw*lw/V/Iy*wgt - aT*lT/V/Iy*wgtlv
dzdt=[dxdt1;dxdt2;dxdt3;dxdt4]
end
El código donde se llama a la función es:
tspan=[0:0.05:10]
CI=[0;0;0;0]
[t Y]= ode45(@funciontp2,tspan,CI)
m=53
Iy=144000
Sw=30
ST=7.5
s=7.5
c=4
Claw=4.5
ClaT=3.2
w=18
Epsilon=0.04
lw=0.6
lT=7
wg0=6.25
V=187.5
le=0.25
la=0.25
lwm=0.1
A=0.1
B=0
ke0=0.1396
Gamma_e0=0.0873
rho=0.784
aw=0.5*rho*V^2*Sw*Claw
aT=0.5*rho*V^2*ST*ClaT
l=lw+lT
t0=l/V
wgt=wg0
wgtlv=((t>=0) & (t<t0)).*0 + (t>=t0).*wg0
zpp=(-aw-aT)/(V*m)*Y(:,2) + (aw*lw+aT*lT)/(V*m)* Y(:,4) - (aw+aT)/(V*m)*Y(:,3)- aw/V/m*wgt - aT/V/m*wgtlv
titapp=(aw*lw-aT*lT)/V/Iy * Y(:,2) + (aT*lT^2-aw*lw^2)/V/Iy * Y(:,4) + (aw*lw-aT*lT)/V/Iy * Y(:,3) + aw*lw/V/Iy*wgt - aT*lT/V/Iy*wgtlv
%z
plot(tspan,zpp)

1 Comment

Ponemos las cosas en orden para poder compilar lo aqui y ver lo que esta pasando.
tspan=[0:0.05:10];
CI=[0;0;0;0];
[t Y]= ode45(@funciontp2,tspan,CI);
m=53;
Iy=144000;
Sw=30;
ST=7.5;
s=7.5;
c=4;
Claw=4.5;
ClaT=3.2;
w=18;
Epsilon=0.04;
lw=0.6;
lT=7;
wg0=6.25;
V=187.5;
le=0.25;
la=0.25;
lwm=0.1;
A=0.1;
B=0;
ke0=0.1396;
Gamma_e0=0.0873;
rho=0.784;
aw=0.5*rho*V^2*Sw*Claw;
aT=0.5*rho*V^2*ST*ClaT;
l=lw+lT;
t0=l/V;
wgt=wg0;
wgtlv=((t>=0) & (t<t0)).*0 + (t>=t0).*wg0;
zpp=(-aw-aT)/(V*m)*Y(:,2) + (aw*lw+aT*lT)/(V*m)* Y(:,4) - (aw+aT)/(V*m)*Y(:,3)- aw/V/m*wgt - aT/V/m*wgtlv;
titapp=(aw*lw-aT*lT)/V/Iy * Y(:,2) + (aT*lT^2-aw*lw^2)/V/Iy * Y(:,4) + (aw*lw-aT*lT)/V/Iy * Y(:,3) + aw*lw/V/Iy*wgt - aT*lT/V/Iy*wgtlv;
%z
plot(tspan,zpp)
function dzdt=funciontp2(t,x)
m=53;
Iy=144000;
Sw=30;
ST=7.5;
s=7.5;
c=4;
Claw=4.5;
ClaT=3.2;
w=18;
lw=0.6;
lT=7;
wg0=6.25;
V=187.5;
le=0.25;
la=0.25;
lwm=0.1;
A=0.1;
B=0;
ke0=0.1396;
Gamma_e0=0.0873;
rho=0.784;
aw=0.5*rho*V^2*Sw*Claw;
aT=0.5*rho*V^2*ST*ClaT;
l=lw+lT;
t0=l/V;
wgt=wg0;
wgtlv=((t>0) & (t<t0)).*0 + (t>=t0).*wg0;
dxdt1=x(2);
dxdt2=(-aw-aT)/(V*m)*x(2) + (aw*lw+aT*lT)/(V*m)* x(4) - (aw+aT)/(V*m)*x(3)- aw/V/m*wgt - aT/V/m*wgtlv;
dxdt3=x(4);
dxdt4=(aw*lw-aT*lT)/V/Iy * x(2) + (aT*lT^2-aw*lw^2)/V/Iy * x(4) + (aw*lw-aT*lT)/V/Iy * x(3) + aw*lw/V/Iy*wgt - aT*lT/V/Iy*wgtlv;
dzdt=[dxdt1;dxdt2;dxdt3;dxdt4];
end

Sign in to comment.

 Accepted Answer

Cris LaPierre
Cris LaPierre on 30 Mar 2023
Edited: Cris LaPierre on 2 Apr 2023
No puedo recrear su error, ni aqui, ni en R2016a. Ponga un punto y coma al fin de cada linea para que se ejecute mas rapido su codigo.
Tiene que quardar funciontp2 en su propio archive con el nomber funciontp2.m en R2016a.
Si usas el codigo que puse arriba, no debe haber un error.

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Products

Release

R2016a

Tags

Asked:

on 30 Mar 2023

Edited:

on 2 Apr 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!