fft of breath signal
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1516816/image.jpeg)
I got this result from this code, but the plot should be sth like this below image, how can I make it more smooth?
phi = atan2(Q_ch, I_ch);
phi = unwrap(phi);
time_taken = length(I_ch)/Fs;
t_array = linspace(0, time_taken, length(I_ch));
Range = (c.*phi)/(4*pi*fc);
min_range = min(Range);
adjusted_range = Range - min_range;
Range = ((c.*phi)/(4*pi*fc));
figure;
plot(t_array, -adjusted_range);
title("Respiratory Rate CW");
xlabel("Time");
ylabel("Amplitude");
%fft
range_fft = abs(fft(abs(Range)));
range_fft_half = range_fft(1:length(range_fft)/2);
%DB Value
fft_db_norm = 20*log10(range_fft_half);
fft_db_norm = fft_db_norm(1:100) - max(fft_db_norm(1:100));
fft_db_norm(fft_db_norm < -60) = -60;
fft_db_norm(fft_db_norm > 0) = 0;
%Plot
f_array = linspace(0, 2, length(fft_db_norm));
figure;
plot(f_array, fft_db_norm);
title("Heart Rate (FFT)");
xlabel("Frequency (Hz)");
ylabel("Amplitude (dB)");
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1516821/image.jpeg)
0 commentaires
Réponses (1)
Image Analyst
le 20 Oct 2023
Looks like it has a lot more sample points, hence it can follow that curve better. Yours has fewer points so it looks choppy. See if you can sample Q_ch and I_ch at higher sampling rates to get more resolution (more elements in your vectors). Otherwise you'll just have to handle what you've got.
Give context: why do you think you need it to be smoother anyway? Maybe it doesn't need to be.
0 commentaires
Voir également
Catégories
En savoir plus sur Fourier Analysis and Filtering dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!