Effacer les filtres
Effacer les filtres

How can I solve this 12x12 system of odes using any solver (i used ode45) without "Dimensions of matrices being concatenated are not consistent" error??

1 vue (au cours des 30 derniers jours)
i used the code below in matlab but giving errors, how can solve it?
f = @(t,v)[ -v(5)*v(3) + v(6)*v(2) -g*sin(v(7)) + g*sin(v(7)) + Xu*(v(1) - u0) + Xw*(v(3) - w0);
v(4)*v(3) -v(6)*v(1) + g*cos(v(7))*sin(v(8)) + -g*cos(v(7))*sin(v(8)) + Yv*(v(2) - v0);
v(5)*v(1) -v(4)*v(2) + g*cos(v(7))*cos(v(8)) + -g*cos(v(7))*cos(v(8)) + Zu*(v(1) - u0) + Zw*(v(3) - w0);
(v(5)*v(6)*(Iyy - Izz) + Ixz*v(4)*v(5) + Ixz*((v(4)*v(5)*(Ixx - Iyy) - Ixz*v(5)*v(6)*Ixx + v(5)*v(6)*(Iyy - Izz) + Ixz*v(4)*v(5)*Ixz)/(Izz*Ixx - Ixz^2)))/Ixx;
(M + v(6)*v(4)*(Izz - Ixx) + Ixz*((v(6))^2 - (v(4))^2))/Iyy;
(v(4)*v(5)*(Ixx - Iyy) - Ixz*v(5)*v(6)*Ixx + v(5)*v(6)*(Iyy - Izz) + Ixz*v(4)*v(5)*Ixz)/(Izz*Ixx - Ixz^2);
v(5)*cos(v(8)) - v(6)*sin(v(8)) + 0*sin(v(9));
v(4) + v(5)*sin(v(8))*tan(v(8)) + v(6)*cos(v(8))*tan(v(8));
(v(5)*sin(v(8)) + v(6)*cos(v(8)))/cos(v(7));
(v(1) - u0)/v(4);
(v(2) - v0)/v(5);
(v(3) - w0)/v(6)];
[t,va] = ode45(f,[0 100],[u0 v0 w0 p0 q0 r0 theta0 phi0 Lphi0 rx0 ry0 rz0]);
it gives the error below;
Error using vertcat
Dimensions of matrices being concatenated are not consistent.
Error in
@(t,v)[-v(5)*v(3)+v(6)*v(2),-g*sin(v(7))+g*sin(v(7))+Xu*(v(1)-u0)+Xw*(v(3)-w0);v(4)*v(3),-v(6)*v(1)+g*cos(v(7))*sin(v(8))+-g*cos(v(7))*sin(v(8))+Yv*(v(2)-v0);v(5)*v(1),-v(4)*v(2)+g*cos(v(7))*cos(v(8))+-g*cos(v(7))*cos(v(8))+Zu*(v(1)-u0)+Zw*(v(3)-w0);(v(5)*v(6)*(Iyy-Izz)+Ixz*v(4)*v(5)+Ixz*((v(4)*v(5)*(Ixx-Iyy)-Ixz*v(5)*v(6)*Ixx+v(5)*v(6)*(Iyy-Izz)+Ixz*v(4)*v(5)*Ixz)/(Izz*Ixx-Ixz^2)))/Ixx;(M+v(6)*v(4)*(Izz-Ixx)+Ixz*((v(6))^2-(v(4))^2))/Iyy;(v(4)*v(5)*(Ixx-Iyy)-Ixz*v(5)*v(6)*Ixx+v(5)*v(6)*(Iyy-Izz)+Ixz*v(4)*v(5)*Ixz)/(Izz*Ixx-Ixz^2);v(5)*cos(v(8))-v(6)*sin(v(8))+0*sin(v(9));v(4)+v(5)*sin(v(8))*tan(v(8))+v(6)*cos(v(8))*tan(v(8));(v(5)*sin(v(8))+v(6)*cos(v(8)))/cos(v(7));(v(1)-u0)/v(4);(v(2)-v0)/v(5);(v(3)-w0)/v(6)]
Error in odearguments (line 87)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 113)
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
  1 commentaire
kayemba luwaga
kayemba luwaga le 28 Jan 2021
eeeeh, I got the solution from an example in the link below before anyone answered! (i unconsistently used space between "-" operators). Thanks to those who were willing to help me out, anyway...........
https://www.reddit.com/r/matlab/comments/8m29ru/dimensions_of_matrices_being_concatenated_are_not/

Connectez-vous pour commenter.

Réponses (1)

Kayemba Luwaga
Kayemba Luwaga le 4 Juil 2022
I got the solution from an example in the link below before anyone answered! (inconsistent spacing between "-" operators).
https://www.reddit.com/r/matlab/comments/8m29ru/dimensions_of_matrices_being_concatenated_are_not/

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by