Reverse the X and Y axis values in a 3D plot

I have used below code to plot a 3D plot.
f1=2 ; f2=1.8 ; .... ....
Pt=0:5:30;
A1=2*pi*del*f1*f1*Vt*Vt*10^18; A2=2*pi*del*f2*f2*Vt*Vt*10^18; .... ....
B=c^2*Pt*s*t;
K1=(A1./B)./10; K2=(A2./B)./10; .... ....
f11=[f1;f2;f3;f4;f5;f6;f7;f8;f9;f10]; K=[K10;K9;K8;K7;K6;K5;K4;K3;K2;K1]; Pt=[Pt;Pt;Pt;Pt;Pt;Pt;Pt;Pt;Pt;Pt];
figure,surf(Pt,f11,K);
In the 3D plot I need to reverse the X-axis (f) and Y-axis (K) values in reverse order.
Could you please tell me how to do it?

 Akzeptierte Antwort

Oleg Komarov
Oleg Komarov am 13 Mär. 2012

4 Stimmen

% An example:
[X,Y,Z] = peaks(30);
surfc(X,Y,Z)
colormap hsv
axis([-3 3 -3 3 -10 5])
% Reverse x and y axis
set(gca,'Xdir','reverse','Ydir','reverse')

Weitere Antworten (1)

Sean de Wolski
Sean de Wolski am 12 Mär. 2012

0 Stimmen

doc flipud
doc fliplr
flip the data using one of the above.
maybe:
%Get the current axes data, flip it and set it
set(gca,'xdata',fliplr(get(gca,'xdata')))

4 Kommentare

ravi
ravi am 13 Mär. 2012
I have modified the last lines as below.
set(gca,'f11',fliplr(get(gca,'f11')))
set(gca,'K',fliplr(get(gca,'K')))
figure,surf(Pt,f11,K);
But I got the below error.
There is no 'f11' property in the 'axes' class.
Error in ==> t2 at 88
set(gca,'f11',fliplr(get(gca,'f11')))
Could you please help.
Sean de Wolski
Sean de Wolski am 13 Mär. 2012
fll would be the axes' 'ydata'.. axes doesnt; care what it was the variable called before.
ravi
ravi am 13 Mär. 2012
I have changed as below.
set(gca,'ydata',fliplr(get(gca,'ydata')))
But still got the similar error.
??? There is no 'ydata' property in the 'axes' class.
Sean de Wolski
Sean de Wolski am 13 Mär. 2012
My bad, that does error. Try this:
h = surf(magic(5));
pause(5); %look around
set(h,'ydata',flipud(get(h,'ydata')))
drawnow;

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Data Distribution Plots finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by