# Zero-pad to chirp signal

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. – robert bristow-johnson 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? – Mo Re 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. – robert bristow-johnson 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$.