Issue in finding Power Spectral Density of fitted curve

Illustration
ishitaisha6840 - 2021-01-25T10:26:05+00:00
Question: Issue in finding Power Spectral Density of fitted curve

I have a respiration signal which is sinusoidal in shape. I have fitted the curve using Fourier series. Since the fitted curve is in cfit format, I am not able to find it's Power Spectral Density.

Expert Answer

Profile picture of John Michell John Michell answered . 2025-11-20

Evaluate the fit at the desired frequency for however long you have data and pass that result to fft
 
ADDENDUM: See the comment below for specific, but just use
 
 
yhat=resp_f(t);

to get predicted y at times t

 

 

 

Even-Length Input with Sample Rate

Obtain the periodogram for an even-length signal sampled at 1 kHz using both fft and periodogram. Compare the results.

Create a signal consisting of a 100 Hz sine wave in N(0,1) additive noise. The sampling frequency is 1 kHz. The signal length is 1000 samples. Use the default settings of the random number generator for reproducible results.

 

rng default
Fs = 1000;
t = 0:1/Fs:1-1/Fs;
x = cos(2*pi*100*t) + randn(size(t));

Obtain the periodogram using fft. The signal is real-valued and has even length. Because the signal is real-valued, you only need power estimates for the positive or negative frequencies. In order to conserve the total power, multiply all frequencies that occur in both sets — the positive and negative frequencies — by a factor of 2. Zero frequency (DC) and the Nyquist frequency do not occur twice. Plot the result.

ASK NOW

Get a Free Consultation or a Sample Assignment Review!