2x2 matrix that changes with iteration of for loop
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
David Fariyike
el 27 de Jun. de 2020
Comentada: David Fariyike
el 27 de Jun. de 2020
Hello,
I am trying to define a 2x2 matrix that changes with each increment of a for loop. This is what I currently have but it only gives me 1 2x2 matrix.
for ii=1:length(tt),
J={-L1*s1(ii)-L2*s12(ii) -L2*s12(ii);
L1*c1(ii)+L2*c12(ii) L2*c12(ii)};
end
I am not defining everything for simplicity purposes. But s1(ii), s12(ii), c1(ii), and c12(ii) are all solved in the for loop and each a 1x5001 matrix. The L1 and L2 are constants. I am trying to define J as a 2x2 matrix 5001 times.
0 comentarios
Respuesta aceptada
madhan ravi
el 27 de Jun. de 2020
s1 = reshape(s1,1,1,[]);
s12 = reshape(s12,1,1,[]);
c1 = reshape(c1,1,1,[]);
c12 = reshape(c12,1,1,[]);
J = [-L1*s1-L2*s12, -L2*s12;
L1*c1+L2*c12, L2*c12]
1 comentario
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!