# Changing Units of Axis

I'm writing a Code for STFT in matlab and I am in the initial stage. Right now I have managed to do the FFT of a small chunk of a time signal. I used zero padding.

The problem I am facing is that after FFT there are 3500 bin frequencies. (In total there were 7000, I took half of them). My sampling frequency was 1000. So that equates 1 Bin = 10/35 Hz.

When I plot the data, I have the bin values in the X-Axis. In this was my Signal seems to have amplitudes in the 421st Bin or 60Hz.

How can I make my X-Axis such that it progresses by 10/35 and shows the spike in the correct place at 60 instead of 421. Thanks.

• Welcome to DSP.SE! It's not clear for me what you are trying to achieve? Do you want to ensure that a 60 Hz tone shows a peak in the 60th bin? That probably won't happen: even if you had 1 bin = 1 Hz, you'd still have 60Hz turning up in the 61st bin. Can you please clarify what you're asking for? – Peter K. Nov 19 '15 at 13:10
• Hey, Thanks for the reply. I was asking if I could change the notation in the axis in the Graph/Plot. The notation of the 421 bin should be 60. I want to represent the bins 0 to 3500 bins in the graph from 0 to 500. That way the figure will show the Spike and Say underneath it "60". – Rio1210 Nov 19 '15 at 13:15

Thanks for the clarification.

If you're currently doing

plot(y)


then you should do

plot(x,y)


where

x = linspace(0,1000,length(y));

• This did the trick. Can't believe I missed it though. Thanks. – Rio1210 Nov 19 '15 at 14:12
• @Rio1210 : If it solved your problem, please give it the tick! :-) – Peter K. Nov 20 '15 at 1:57