Clear Filters
Clear Filters

surface plots with different views

14 views (last 30 days)
Joseph
Joseph on 3 Apr 2014
Answered: Star Strider on 3 Apr 2014
my objective is to create four surface plots of the same function in the same window. I can easily create the 4 subplots.
my issue is coming with the different views. I need an isometric view, and views normal to the XY plane, XZ plane and YZ plane. Thanks for your help here is my code:
x = -10:1:10;
y = x;
[xGrid,yGrid] = meshgrid(x,y);
z = (1./((xGrid+3).^2 + (yGrid-1).^2 + 2)) + ((xGrid-yGrid) ./ ((xGrid-1) .^2 + (yGrid-2) .^2 + 4));
subplot(2,2,1)
surf(x,y,z)
title('Isometric View')
xlabel('X')
ylabel('Y')
zlabel('Z')
subplot(2,2,2)
surf(x,y,z)
view(0,0)
title('View Normal to X-Y Plane')
xlabel('X')
ylabel('Y')
zlabel('Z')
subplot(2,2,3)
surf(x,y,z)
view(0,0)
title('View Normal to X-Z Plane')
xlabel('X')
ylabel('Y')
zlabel('Z')
subplot(2,2,4)
surf(x,y,z)
view(0,0)
title('View Normal to Y-Z Plane')
xlabel('X')
ylabel('Y')
zlabel('Z')

Answers (1)

Star Strider
Star Strider on 3 Apr 2014
I suggest experimenting with the ‘ view ’ function to see if it does what you want.

Community Treasure Hunt

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

Start Hunting!