Subscripted assignment dimension mismatch : When using ode45
Afficher commentaires plus anciens
Why does MATLAB throw this error? I'm multiplying a 4*3 matrix with a 3*1 matrix to obtain 4*1 matrix(d). my differentiation equation is dy/dt=1/2*d which should give me a 4*1 matrix.
w1=0.0181844;
w2=0.128911;
w3=0;
w=[w1;w2;w3];
E1=0.704416;
E2=-0.0616284;
E3=0.0616284;
E4=0.704416;
y=[E1;E2;E3;E4];
M=[E4 -E3 E2;E3 E4 -E1;-E2 E1 E4;-E1 -E2 -E3];
d=M*w;
tspan=[0 0.0001 1];
y0=[0;0;0;0];
a=1/2;
options = odeset('AbsTol',1e-8);
[t,y]=ode45(@(t,y) EuRodFunc(t,y,a,d),tspan,y0);
function dydt = EuRodFunc(t,y,a,d)
dydt(1)=a.*d;
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!