Matrix dimensions must agree
Show older comments
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
Accepted Answer
More Answers (1)
Image Analyst
on 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 Comment
the cyclist
on 28 Jan 2012
+1 to this advice
Categories
Find more on Debugging and Improving Code in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!