I have generated 16 chirps in experimental study: and the signal was picked up by some electronic sensor, and then I have calculated the spectrum of the received signal: Following that I have calculated the cross spectrum density between the sound emitter and receiver and did some post processing, i.e.:

x=voltage1(:,2);
y1=vertgeo1(:,2);

Fs=1000;
window=hamming(512);
noverlap=512/2
nfft=512;Fs=1000;

[Pxy1,f]=cpsd(x,y1,window,noverlap,nfft,Fs);


From this code the number of the points that shows the frequency resolution, essentially the number of the point that f contains is $1\times 256$.

I would like to know how I can increase this to $1025$ points.

• increase what? the size of the FFT, the size of the window? sure you can. Apr 14 '16 at 1:20
• Many thanks for your reply, Increase the size of FFT, do I need to add zero padding to each chirp or just I need to add it at the end of the signal? Apr 14 '16 at 8:31
• so the chirp cannot be longer? if that is the case, you don't want to increase the size of the window, but then zero-pad the windowed signal that you are sending to the FFT. Apr 14 '16 at 20:26

No you don't need to zero-pad each chirp. MATLAB's cspd function divide the signal into segments of length nfft. Would you want is to zero-pad each segment. Luckily for you, the cspd function can do it for you. Take a look here:

If $\tt nfft$ is greater than the signal length, the data is zero-padded. If $\tt nfft$ is less than the signal length, the segment is wrapped so that the length is equal to $\tt nfft$.

So what you should do is increase the value of nfft from $512$ to $2048$.

• well I want to have a frequency resolution of fs/nfft=1000/2048= 0.488. but I have no idea to do that. Apr 15 '16 at 11:33
• I do not understand how I can increase my frequency resolution, do I need to add zero padding to the length of my window or doing something else? Apr 15 '16 at 13:19
• Well, as I wrote in my answer, change the value of nfft to 2048. That would result in frequency interpolation.
– ThP
Apr 15 '16 at 16:04
• The nfft shouldn't be less than sampling rate? Apr 15 '16 at 16:54
• No it can also be greater
– ThP
Apr 15 '16 at 17:21