Azzera filtri
Azzera filtri

Help with Cross-correlation and Auto-correlation

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

Image Analyst
Image Analyst il 26 Giu 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 Commenti
Image Analyst
Image Analyst il 29 Giu 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 il 30 Giu 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

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by