figure view direction issue
Mostra commenti meno recenti
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)
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Graphics Performance in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!