Matrix dimensions must agree
Mostrar comentarios más antiguos
Hello!
I have written the code which uses a function
function f1=F_1(y,z);
global gamma
global a
f1=-(1/2)*exp(-(z-a)./(1+gamma*cos(2*pi*y)))+1/2;
end
When I try to run I get a error Error using / Matrix dimensions must agree
Could you please help me?
Thank you in advance.
Elena
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 28 de En. de 2012
0 votos
You should really learn how to use the debugger. It's much more efficient than asking us for every simple thing like this. For example, if you put a breakpoint at that line and examine the lengths of y,z, gamma, and a, you'll probably find that some of them aren't scalars and those that aren't don't have the same lengths.
1 comentario
the cyclist
el 28 de En. de 2012
+1 to this advice
Categorías
Más información sobre Debugging and Improving Code en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!