Trouble with 3D surface Plotting.
Show older comments
How can I set the z axis for this plot? It changes with every iteration regardless of what the axis function tells it to do.
clear all
clear
clc
x = linspace(0,2,30); %x data points
y = linspace(0,3,20); %y data points
[xgrid,ygrid] = meshgrid(x,y); %create grid of all x and y points
m=1;
n=1;
figure(3)
axis square
box on
grid on
t= linspace(0,5,50);
for k = 1:50
axis([0 2 0 3 -5 5])
animate = (576/(pi^6)).*((((1+((-1).^(m+1))).*(1+((-1).^(n+1))))/(m.^3.*n.^3)).*sin((m.*pi.*xgrid)/2).*sin((m.*pi.*ygrid)/3).*cos(pi.*t(k).*(sqrt(9.*(m.^2)+4.*(n.^2)))));
surf(xgrid,ygrid,animate);
pause(0.01);
colormap jet
box on
axis([0 2 0 3 -5 5])
end
Accepted Answer
More Answers (0)
Categories
Find more on Surface and Mesh Plots 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!