whats the error in the surface plot? How to correct it?

[x y]=meshgrid(13:120,1:12);
igx1=((x.*y.^3)/12)+(x.*y).*((((x.*y).*(150-(y./2))+113664+6000)/((x.*y)+1536+1200))-(150-(y./2))).^2;
igx2=2097152+1536.*((((x.*y)*(150-(y./2))+113664+6000)/((x.*y)+1536+1200))-74).^2;
igx3=10000+1200.*((((x.*y)*(150-(y./2))+113664+6000)/((x.*y)+1536+1200))-5).^2;
[z]=igx1+igx2+igx3;
surf(x,y,z)
Capture.PNG

 Accepted Answer

Use dots after * and / (element wise operation):
[x y]=meshgrid(13:120,1:12);
igx1=((x.*y.^3)/12)+(x.*y).*((((x.*y).*(150-(y./2))+113664+6000)./((x.*y)+1536+1200))-(150-(y./2))).^2;
igx2=2097152+1536.*((((x.*y).*(150-(y./2))+113664+6000)./((x.*y)+1536+1200))-74).^2;
igx3=10000+1200.*((((x.*y).*(150-(y./2))+113664+6000)./((x.*y)+1536+1200))-5).^2;
z=igx1+igx2+igx3;
surf(x,y,z)
Screen Shot 2018-12-06 at 3.13.38 PM.png

More Answers (0)

Asked:

on 6 Dec 2018

Edited:

on 6 Dec 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!