Effacer les filtres
Effacer les filtres

Help with Cross-correlation and Auto-correlation

1 vue (au cours des 30 derniers jours)
David Jones
David Jones le 26 Juin 2021
Commenté : David Jones le 30 Juin 2021
Hi
I don’t have that much experience in MATLAB, I hope someone can point me in the right direction, I am looking at breathing and the rate and various ways to detect this. I am currently looking into Cross correlation and auto correlation can somebody please help me setup some basic code and give me a few pointers.
I have attached a file which has 6000 samples, 100 samples per second, over 60 seconds.
Any help would be greatly appreciated.
Kind Regards
David

Réponse acceptée

Image Analyst
Image Analyst le 26 Juin 2021
Try this:
s = load('raw_data.mat')
y = s.raw_ad_data_sine;
plot(y, 'b-', 'LineWidth', 2);
grid on;
% Find peaks
[peakValues, indexesOfPeaks] = findpeaks(y, 'MinPeakDistance', 200, 'Threshold', 1000);
% Plot them.
hold on;
plot(indexesOfPeaks, y(indexesOfPeaks), 'rv', 'LineWidth', 2, 'MarkerSize', 10);
% Find valleys
[valleyValues, indexesOfValley] = findpeaks(-y, 'MinPeakDistance', 200, 'Threshold', 1000);
valleyValues = -valleyValues;
% Plot them.
hold on;
plot(indexesOfValley, y(indexesOfValley), 'r^', 'LineWidth', 2, 'MarkerSize', 10);
  5 commentaires
Image Analyst
Image Analyst le 29 Juin 2021
Not sure what that means but you can create an x axis if you want with linspace. If the total length of y is 60 seconds, you can make x like
x = linspace(0, 60, length(y));
David Jones
David Jones le 30 Juin 2021
Hi
I am strugling to get the display to show the 60s of data correctly, please see atached display I need to display the last graph (5) with the x axis showing the correct timimng , could you please help.
David

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by