Matrix dimensions must agree
Ältere Kommentare anzeigen
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
Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 28 Jan. 2012
0 Stimmen
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 Kommentar
the cyclist
am 28 Jan. 2012
+1 to this advice
Kategorien
Mehr zu Debugging and Improving Code finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!