Subtractive Baseline-correction

조회 수: 12 (최근 30일)
Camilla
Camilla 2024년 5월 14일
댓글: Mathieu NOE 2024년 5월 14일
Hello All,
Im trying to do a subtractive baseline correction on pupil data. I wrote the skript already but when i plot the data, it seems like the baseline correction did not work. The graphs do not all start from the same point. Any ideas of what i could´ve done wrong?
Thank you in advance
%Verzeichnis
Verzeichnis = '/Users/eliebonin/Documents/MATLAB/edf_daten_elie/Datensatz eye tracking';
%Daten laden
load('testmat3.mat')
%Überprüfen der Größe der Matrix
[proben_anzahl, ~] = size (testmat3);
%Sicherstellen, dass die Anzahl der Proben größer oder gleich 10 ist
if proben_anzahl < 10
error ('Es gibt nicht genügend Proben für Baseline correction');
end
%Definieren des Zeitbereiches für die Baseline
baseline_zeitraum = 1:10; %Annahme: Die ersten zehn Samples entgsprechen dem Baseline-Zeitraum
%Berechnen des Mittelwerts während des baseline Zeitraums für jede Probe
baseline_groesse = mean(testmat3(:,baseline_zeitraum), 2);
%substraktion des Baseline-Mittelwerts von allen Pupillengrößen für jede
%Probe
baseline_corrected_daten = testmat3 - baseline_groesse;
save('baseline_correction.mat', 'baseline_corrected_daten');

채택된 답변

Mathieu NOE
Mathieu NOE 2024년 5월 14일
hello
I was first a bit puzzled when you mention the baseline is made of the first 10 samples - but after several readings it seems to me you think "probes" and not samples
so the baseline is the mean(correct) but in the other dimension (along the "probe" dimension and not te time / samples dimension)
also , as your data conatin nan's it's good idea to use 'omitnan' in the mean computation parameters.
I suspect this is what you wanted to do
%Daten laden
load('testmat3.mat')
figure(1),plot(testmat3)
%Überprüfen der Größe der Matrix
[proben_anzahl, ~] = size (testmat3);
%Sicherstellen, dass die Anzahl der Proben größer oder gleich 10 ist
if proben_anzahl < 10
error ('Es gibt nicht genügend Proben für Baseline correction');
end
%Definieren des Zeitbereiches für die Baseline
baseline_zeitraum = 1:10; %Annahme: Die ersten zehn Samples entgsprechen dem Baseline-Zeitraum
%Berechnen des Mittelwerts während des baseline Zeitraums für jede Probe
% baseline_groesse = mean(testmat3(:,baseline_zeitraum), 2, 'omitnan');
baseline_groesse = mean(testmat3(baseline_zeitraum,:), 1, 'omitnan');
%substraktion des Baseline-Mittelwerts von allen Pupillengrößen für jede
%Probe
baseline_corrected_daten = testmat3 - ones(size(testmat3,1),1)*baseline_groesse;
figure(2),plot(baseline_corrected_daten)
save('baseline_correction.mat', 'baseline_corrected_daten');
  댓글 수: 4
Camilla
Camilla 2024년 5월 14일
Thank u so so much this worked perfectly for me!
Mathieu NOE
Mathieu NOE 2024년 5월 14일
as always, my pleasure !

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Joe Vinciguerra
Joe Vinciguerra 2024년 5월 14일
I suspect you want this:
baseline_groesse = mean(testmat3(baseline_zeitraum,:), 1);
instead of this:
baseline_groesse = mean(testmat3(:,baseline_zeitraum), 2);

카테고리

Help CenterFile Exchange에서 Electrophysiology에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by