Reputation: 1085
I am trying to generate a 3D surface plot for x,y,z data using surf():
[x,y] = meshgrid(0.5:0.5:25, 0.5:0.5:45);
Z=(tand(y/2)*(1.84+x))*2;
but I get the following error:
Error using * Inner matrix dimensions must agree.
Upvotes: 0
Views: 370
Reputation: 699
Use the element-wise product:
Z=(tand(y/2).*(1.84+x))*2;
surf(x,y,Z);
Upvotes: 3