From: Jongil Lim on
Dear All,
I would like to plot spectrogram using time vs. frequency starting zero.
But, y axis shows 250 to 0 in a reverse way.
How could I make it starting 0 to 250?
I tried "view(0,-90)" and it looked working but, the image was gone.
Please let me know if anyone knows.
Thank you in advance.
Regards,
Jongil

%--------------------------------------------------------------------------

clear all;
N=500; % Number of points
fs=500; % Sample freq;
f1=10; % Minimum frequency
f2=200; % Maximum frequency
t=(1:N)/fs;
%Generate chirp signal (i.e., linear change in freq)
fc=((1:N)*((f2-f1)/N))+f1;
x=sin(pi*t.*fc);

window=15;
nfft=500;
noverlap=0;
figure(21)
[Bb,ff,tt]=spectrogram(x,window,noverlap,nfft,fs);
cc=abs(Bb);
imagesc(tt,ff,cc);
%view(0,-90);
colorbar('EastOutside');
From: Wayne King on
"Jongil Lim" <jongil_lim(a)hotmail.com> wrote in message <ht1i3l$drs$1(a)fred.mathworks.com>...
> Dear All,
> I would like to plot spectrogram using time vs. frequency starting zero.
> But, y axis shows 250 to 0 in a reverse way.
> How could I make it starting 0 to 250?
> I tried "view(0,-90)" and it looked working but, the image was gone.
> Please let me know if anyone knows.
> Thank you in advance.
> Regards,
> Jongil
>
> %--------------------------------------------------------------------------
>
> clear all;
> N=500; % Number of points
> fs=500; % Sample freq;
> f1=10; % Minimum frequency
> f2=200; % Maximum frequency
> t=(1:N)/fs;
> %Generate chirp signal (i.e., linear change in freq)
> fc=((1:N)*((f2-f1)/N))+f1;
> x=sin(pi*t.*fc);
>
> window=15;
> nfft=500;
> noverlap=0;
> figure(21)
> [Bb,ff,tt]=spectrogram(x,window,noverlap,nfft,fs);
> cc=abs(Bb);
> imagesc(tt,ff,cc);
> %view(0,-90);
> colorbar('EastOutside');

Hi Jongil, use

axis xy;


Hope that helps,
Wayne