Matrix Dimensions Must Agree Error, Error using +

-2*(D2*(q_(1,:)'))-2*pr.*(f_(1,:)').*(D1*(q_(1,:)'))...
+2*pr.*A*(D1*(f_(1,:)')).*((q_(1,:)'))-de.*pr.*((A*(f_(1,:)')).*(D2*(f_(1,:)')).*(q_(1,:)')...
+A*(2*(size(x))+A)*((f_(1,:)').^2).*(q_(1,:)')+(eye(size(x))+2*A)*(f_(1,:)').*(D1*(f_(1,:)')).*(D1*(q_(1,:)'))-((f_(1,:)').^2).*(D2*(f_(1,:)')));

4 comentarios

Walter Roberson
Walter Roberson el 27 de Nov. de 2017
You have given us no information about the size() of each of the variables involved.
mariam ahmad
mariam ahmad el 27 de Nov. de 2017
i get this error in first line
the cyclist
the cyclist el 27 de Nov. de 2017
You are not giving us info to debug this directly. But I can give you some advice on how to debug it.
When you have a long line of code like this, try to separately evaluate small segments. Remove sections until the code runs, and then add them back in one-by-one. Try to isolate the piece that makes this break, in a systematic fashion.
MHZ
MHZ el 27 de Nov. de 2017
Editada: Walter Roberson el 27 de Nov. de 2017
Mariam, We don't know the values for any of your variables, so we cannot reproduce the error. Can you put the full script please?
On a side note: you are switching between element and matrix multiplication (the dot ".") .* is element wise multiplication. * is matrix multiplication. I suggest you check that.

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Preguntada:

el 27 de Nov. de 2017

Cerrada:

el 20 de Ag. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by