Matrix dimensions must agree
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (1)
Image Analyst
le 28 Jan 2012
0 votes
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 commentaire
the cyclist
le 28 Jan 2012
+1 to this advice
Catégories
En savoir plus sur Debugging and Improving Code dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!