Issue in finding Power Spectral Density of fitted curve

2 ビュー (過去 30 日間)
Rohan Gupta
Rohan Gupta 2017 年 7 月 4 日
編集済み: dpb 2017 年 7 月 7 日
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.
Can anyone help me out with this.

採用された回答

dpb
dpb 2017 年 7 月 4 日
編集済み: dpb 2017 年 7 月 5 日
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
  2 件のコメント
Rohan Gupta
Rohan Gupta 2017 年 7 月 6 日
Thanks, this has really solved my problem.
Just one more query, you have mentioned below that, I know the frequency content of the fitted signal from the series fit. I would like to know as how can I know the frequency of fitted signal without further calculation.
dpb
dpb 2017 年 7 月 6 日
編集済み: dpb 2017 年 7 月 7 日
If you did a Fourier fit, there's no content in the fitted signal other than that in the specific terms in the fitted equation and they're all known identically.
ADDENDUM
If you subsequently do actually calculate a PSD by either method, you'll see the peaks at the terms in the fitted model.
The spectrum will, however, not be single spikes at only those frequencies but will be smeared into adjacent frequency bins. These are simply artifacts, however, not actual "real" energy and are due to the windowing and symmetry effects inherent in the computation of a sampled signal.

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2017 年 7 月 4 日
Did you pass the signal into pwelch()? (Requires Signal Processing Toolbox.)
  2 件のコメント
Rohan Gupta
Rohan Gupta 2017 年 7 月 5 日
編集済み: dpb 2017 年 7 月 5 日
Yes, I have tried that. When we give curve fitted signal (which is in cfit format) as an input to pwelch(), it returns an error. It would be really greatful if you can help me out with this.
Following is the code and also the respiratory signal which is used is attached.
load '0009_8min.mat';
t = [1:1:1800]./300;
Fs = 300;
resp = signal.co2.y;
resp_signal = resp(1:1800,:);
[resp_f,gof,output] = fit(t',resp_signal,'fourier8'); % Curve fitted respiration signal
plot(resp_signal);
figure
plot(resp_f);
[pxx2,w2] = pwelch(resp_f,[],[],[],Fs);
The returned error is:
Error in data_read (line 50)
[pxx2,w2] = pwelch(resp_f,[],[],[],Fs);
Reference to non-existent field 'internal'.
dpb
dpb 2017 年 7 月 5 日
編集済み: dpb 2017 年 7 月 5 日
But you now already know what the frequency content of the fitted signal is from the series fit anyway????
Still, pwelch isn't enabled to process a cfit object, evaluate the fit and pass that...
t = [1:1:1800]./300;
[resp_f,gof,output] = fit(t',resp_signal,'fourier8');
[pxx2,w2] = pwelch(resp_f(t),[],[],[],Fs);
...

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeParametric Spectral Estimation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by