Matlab - Representar gráficamente f=@(t,x,v)

 
Vista:

Representar gráficamente f=@(t,x,v)

Publicado por Álex (1 intervención) el 21/11/2014 18:43:30
Hola,
Quiero representar f=@(t,x,v) en función del tiempo, pero me aparece "Error using ==> times Matrix dimensions must agree." Puedo representar vt, xt, xv pero no f=@(t,x,v), que es la aceleración del sistema. El código que uso es:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
x0=input('ángulo inicial, x0: ');
v0=input('velocidad angular inicial, v0: ');
tf=input('tiempo final, tf: ');
n=input('número de pasos, n: ');
w0=0.685;
w=(16.*w0)./(16+x0^2);
g0=9.8;
m=57;
k=0.19;
f=@(t,x,v) +((5.8.*sin(2.*w.*t).*w.*v)./(19.45+1.45.*cos(2.*w.*t)))
t0=0;
hold on
[t,x,v]=rk_4(f,t0,tf,x0,v0,n);
plot(t,((5.8.*sin(2.*w.*t).*w.*v)./(19.45+1.45.*cos(2.*w.*t))),'r');
grid on
hold off

La función rk_4 es un código Runge Kutta 4. No creo que el problema esté ahí ya que sí he representado otras funciones utilizando el mismo código rk_4.

Gracias!!
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder