0
$\begingroup$

I have generated 16 chirps in experimental study:

Time domain data

and the signal was picked up by some electronic sensor, and then I have calculated the spectrum of the received signal:

spectrum of 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.

$\endgroup$
  • 1
    $\begingroup$ increase what? the size of the FFT, the size of the window? sure you can. $\endgroup$ – robert bristow-johnson Apr 14 '16 at 1:20
  • $\begingroup$ 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? $\endgroup$ – Mo Re Apr 14 '16 at 8:31
  • $\begingroup$ 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. $\endgroup$ – robert bristow-johnson Apr 14 '16 at 20:26
1
$\begingroup$

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$.

$\endgroup$
  • $\begingroup$ well I want to have a frequency resolution of fs/nfft=1000/2048= 0.488. but I have no idea to do that. $\endgroup$ – Mo Re Apr 15 '16 at 11:33
  • $\begingroup$ 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? $\endgroup$ – Mo Re Apr 15 '16 at 13:19
  • $\begingroup$ Well, as I wrote in my answer, change the value of nfft to 2048. That would result in frequency interpolation. $\endgroup$ – ThP Apr 15 '16 at 16:04
  • $\begingroup$ The nfft shouldn't be less than sampling rate? $\endgroup$ – Mo Re Apr 15 '16 at 16:54
  • $\begingroup$ No it can also be greater $\endgroup$ – ThP Apr 15 '16 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.