필터 지우기
필터 지우기

how to reverse the axis in matlab??

조회 수: 16 (최근 30일)
Hemant Nagvanshi
Hemant Nagvanshi 2014년 6월 14일
답변: Hemant Nagvanshi 2014년 7월 15일
clc, clear all, close all;
fs = 400;
dt = 1/fs;
t = 0:dt:0.4;
x = sin(2*pi*50*t)';
l = length(x);
y = ceil(log2(l));
nfft = 2^y;
noverlap = 8;
figure(1)
window = 10;
spectrogram(x,window,noverlap,nfft,fs);
title('Window = 25 ms');
The above code plots a spectrogram such that Time is on Y-axis and Frequency on X-axis, I want reverse of it. How can I do that??

채택된 답변

SRI
SRI 2014년 6월 14일
Hi Hemant Kindly Try this code you will get the result as you wish
fs = 400;
dt = 1/fs;
t = 0:dt:0.4;
x = sin(2*pi*50*t)';
l = length(x);
y = ceil(log2(l));
nfft = 2^y;
noverlap = 8;
figure(1)
window = 10;
[S F T P] = spectrogram(x,window,noverlap,nfft,fs);
surf(T,F,10*log10(P),'edgecolor','none');
title('Window = 25 ms');
view(0,90);
xlabel('Time (Seconds)');
ylabel('Hz');
  댓글 수: 1
Hemant Nagvanshi
Hemant Nagvanshi 2014년 7월 15일
time axis is on x-axis but the time are rage are not full. I mean to say spectrogram is not plotted for full time range, what about that.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Hemant Nagvanshi
Hemant Nagvanshi 2014년 7월 15일
spectrogram(x,window,noverlap,nfft,fs); %plots freq in x-axis by default
spectrogram(x,window,noverlap,nfft,fs,'yaxis'); %plots freq in y-axis

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by