Convert Signal from Time Domain to Frequency Domain and then again back to Time domain
2 views (last 30 days)
Show older comments
I have sinusoidal respiration signal of 1 min, which has the respiration rate of 18 breaths/min. I am trying to simulate the respiration signal by using curve fitting technique and using respiration rate (RR) as a control parameter. For, example if I if enter the RR as 24 breaths/min, then respiration signal with 24 breaths/min should be simulated.
I am having problem in generating simulated signal. In the code given below, the simulated signal has the same RR as that of original signal despite providing it different RR.
It would be really grateful, if anyone can help me out with this.
Here's my code
clc clear all
load 'resp.mat'; % Respiration Signal
t = [1:1:18000]./300;
Fs = 300;
resp_signal = resp(1:18000,:); % Respiration Signal for 60 sec
[resp_f,gof,output] = fit(t',resp_signal,'fourier8'); % Curve fitted respiration signal
y_resp = resp_f(t);
psig1 = y_resp - mean(y_resp); % Remove dc component
[pxx1,w1] = pwelch(psig1,[],[],[],Fs); % PSD of the signal
figure
plot(w1,pxx1);
axis([0 10, 0 100]);
[~,loc1] = max(pxx1);
freq1 = w1(loc1);
resp_rate1 = freq1 * 60;
bp = input('Enter Respiration Rate: ');
bps = bp * 17.068;
Fss = bps; % Frequency of the signal to be simulated
psig2 = y_resp - mean(y_resp);
[pxx2,w2] = pwelch(psig2,[],[],[],Fss); % PSD of the simulated signal
figure
plot(w2,pxx2);
axis([0 10, 0 200]);
[~,loc2] = max(pxx2);
freq2 = w2(loc2);
resp_rate2 = freq2 * 60;
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!