필터 지우기
필터 지우기

How to change the scale of the x-axis & y-axis?

조회 수: 550 (최근 30일)
Sultan Al-Hammadi
Sultan Al-Hammadi 2018년 10월 22일
답변: Aron Magesh 2020년 7월 5일
I have written a code which used to plot the spectrogram of a signal. This line was to get the spectrogram:
[s,f2,t] = spectrogram(xc,win,noverlap,FFT_LENGTH,fs,'yaxis');
Then I used imagesc to plot the spectrogram: imagesc(t,f2,20*log10(abs(s)));
Everything is working fine except I want to decrease the scale of the x-axis & y-axis. How can I do that?
  댓글 수: 1
Adam
Adam 2018년 10월 22일
편집: Adam 2018년 10월 22일
Decrease the scale from what to what?
doc xlim
doc ylim
change the axis limits, but I don't know what you mean by 'change the scale', it is very ambiguous. Do you mean change between linear and logarithmic?

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

답변 (3개)

Aron Magesh
Aron Magesh 2020년 7월 5일
For changing the axis scale use the following function:
for example low=10,high=100 and interval=5
set(gca,'xtick', 10:5:100)

Kevin Chng
Kevin Chng 2018년 10월 22일
you may use xlimit() or ylimit() to rescale your plot.
  댓글 수: 4
Sultan Al-Hammadi
Sultan Al-Hammadi 2018년 10월 23일
What I was trying to say is that how to change the scale for the thing circled by a red line [looks like steps] to make it looks like a straight line (not like steps)? (please see the attached spectrogram)
Kevin Chng
Kevin Chng 2018년 10월 24일
Try
h.figure
w = h.Position;
%plot your graph
h.Position = [w(1) w(2) w(3)*1.5 w(4)]
Will it work for you?

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


Adam
Adam 2018년 10월 23일
편집: Adam 2018년 10월 23일
doc interp2
is likely what you need if you want finer resolution to get rid of step-like features, but how was anyone to interpret that from you just keep repeating 'change the scale'? You need to be a lot more precise to get a faster answer.
Or since you are creating a spectrogram you could just use a finer discretisation of the frequencies and/or the times used to compute it.

카테고리

Help CenterFile Exchange에서 Time-Frequency Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by