Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

How to get rid of the error: Error using horzcat. Dimensions of matrices being concatenated are not consistent.

1 visualización (últimos 30 días)
Hi When i solve a second order differential equation with constant coefficients, i obtained a solution. But when i change these coefficients by the matrix form i have obtained this error: Error using horzcat. Dimensions of matrices being concatenated are not consistent. And my new code is a function : function xdot = equadif(t,x) % Function file for mass with spring and damping. % Position is first variable, velocity is second variable. F=[12;23:0]; M=[1,0,0;1,3,0;0,0,2]; cp = 1.38*10^-9; K = [5,-6,1;-6,2,20;4,2,5]; TETA = [1,1,0;2,0,0;1,0,0]; C =[2,10,0;5,4,0;1,5,0]; R = 10*10^3; A = [zeros(3,3), eye(3,3), zeros(3,1); -K*M^-1, -C*M^-1, TETA*M^-1; zeros(3,3), TETA/cp, -1/(R*cp)]; B = [0; M^-1 ; 0]; xdot = A*x+B*F; end
[t,x]=ode45(@equadif,[0,0.01,0.03],[0,1,0]); plot(t,x(:,1),'b',t,x(:,2),'r',t,x(:,3),'--')
Please help me

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by