Matrix dimensions must agree.

1 visualización (últimos 30 días)
KAPIL MAMTANI
KAPIL MAMTANI el 15 de Abr. de 2016
Editada: Stephen23 el 15 de Abr. de 2016
hi, I am getting this error in my code. can anybody help me with this. Thank you in advance.

Respuesta aceptada

Stephen23
Stephen23 el 15 de Abr. de 2016
Editada: Stephen23 el 15 de Abr. de 2016
On that line instead of the right-matrix division operator (which does matrix division):
/
you need to use the right array division operator (which works element-wise):
./
And read this to know the difference:
because you will fix that line and get exactly the same error on the following lines. When you understand the difference between matrix and array operations then you can solve this yourself.
  3 comentarios
KAPIL MAMTANI
KAPIL MAMTANI el 15 de Abr. de 2016
Mister can you tell me if i am solving correctly for Y , Nu and Pu in the code, as they are dependent on the ODEs.
Stephen23
Stephen23 el 15 de Abr. de 2016
Editada: Stephen23 el 15 de Abr. de 2016
The Runge-Kutta method looks okay, except that you are missing the for operator. You should use [your favorite internet search engine] to find examples of Runge-Kutta implementation using MATLAB (there are lots of them). Then you can compare your work, and decide if it is okay.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by