问题
I am plotting amplitude reconstruction of FMCW radar.
I want to flip the inside graph only. However the x axes shoud be the same. How shoud i do it. Below is my code for plotting.
for i = 1:2500 %%%% dividing each row by first row.
resd(i,:) = res3(i,:)./res3(1,:);
end
f = fs/2*linspace(0,1,nfft/2+1); %%%% defining frequency axes
K = BW/Tm;
t = f/K;
deltaf = 1/max(t);
fmax = 1 / t(2)-t(1);
f1 = 0:deltaf:fmax;
% f1 = fmax:deltaf:0;
f2 = f1 + fc;
%%%%%% Amplitude reconstruction
figure(1),plot(f2,abs(resd));
[![enter image description here][1]][1]
回答1:
As be found in the axes documentation, it's simply:
set(gca,'XDir','reverse')
If you just want the labels flipped, just flip the labels:
plot(1:10,1:10)
set(gca, 'XTickLabel', flipud( get(gca, 'XTickLabel') ))
or for Matlab R2014b or higher a little simpler:
a = gca;
a.XTickLabel = flipud(a.XTickLabel);
But be aware, that the labels won't change anymore when resizing the figure. So fix the size in advance.
来源:https://stackoverflow.com/questions/31825432/how-to-flip-the-x-axis