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 commentaire

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

Connectez-vous pour commenter.

 Réponse acceptée

Cris LaPierre
Cris LaPierre le 30 Mar 2023
Modifié(e) : Cris LaPierre le 2 Avr 2023

0 votes

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.

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Centre d'aide et File Exchange

Produits

Version

R2016a

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by