figure view direction issue
이전 댓글 표시
I just need to view figure 2 from the same direction as figure 1, I used the same view commands for both figures but for some reason it only worked for figure 1
clear variables
clc
x=-3*pi:.2:3*pi;
y=-3*pi:.2:3*pi;
for i = 1:length(x)
for j = 1:length(y)
z(i,j)=exp(-(abs(y(j)/7))).*sin(x(i))+exp(-(abs(x(i)/7)))*cos(y(j));
end
end
[X,Y] = meshgrid(x,y);
Z=exp(-(abs(Y/7))).*sin(X)+exp(-(abs(X/7))).*cos(Y);
AZ = -40;
EL = 30;
figure (1)
surfc(x,y,z)
zlim([-1,1.8])
xlabel('x')
ylabel('y')
zlabel('z')
title('z=exp(-|y/7|)sin(x) +exp(-|x/7|))cos(y);')
set(gca, 'XTick', [-5,0,5])
set(gca, 'YTick', [-5,0,5])
colorbar
view(AZ, EL)
figure (2)
surfc(X,Y,Z)
zlim([-1,1.8])
xlabel('x')
ylabel('y')
zlabel('z')
title('z=exp(-|y/7|)sin(x) +exp(-|x/7|))cos(y);')
set(gca, 'XTick', [-5,0,5])
set(gca, 'YTick', [-5,0,5])
colorbar
view(AZ, EL)
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!