How to obtain each each maximum value from each signal set?
25 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all
Because I am doing a special flow cytometry and I got 8 sets of wave, which means 1 set of wave is 1 cell pass through my sensor.
Now, I want to know how to pick up the maximum amplitude from each sets of wave?
Plus, are there any method to prevent double pick if one set of wave have same max value?
Thanks!
10 commentaires
Peng Li
le 30 Avr 2020
Sorry didn't log on these days. quite stressful working from home...
see below an example using your synthetic data
%% Your Generate signal Copied here
fs = 1e9;
tc = gauspuls('cutoff',10e3,0.5,[],-40);
t = -tc:1/fs:tc;
x = gauspuls(t,10e3,0.5);
ts = 0:1/50e3:0.025;
d = [0:1/1e3:0.025;sin(2*pi*0.1*(0:25))]';
y = pulstran(ts,d,x,fs);
plot(ts,y)
xlim([0 0.01])
%% segmentation
baseline = ismembertol(y, 0, 1e-3);
% convert 0-1 series baseline to segments
incl = baseline ~= 1;
incT = diff([0; incl(:); 0]);
stId = find(incT == 1);
edId = find(incT == -1) - 1;
seg = [stId(:) edId(:)];
% you could possibly add some condition here to filter out segments that is
% too short
% alternatively (better), you find the between-waves segments, and add
% conditions to check the length of these segments. If too short, this
% might be a wrong detection and you delete it to merge the two waves
% let me know if this is clear for you
%% with each segment, detect maximum
% can use for, or arrayfun for better readability
pind = nan(size(seg, 1), 1);
for iS = 1:size(seg,1)
[~, ind] = max(y(seg(iS, 1):seg(iS, 2)));
pind(iS) = ind + seg(iS, 1) - 1;
end
hold on;
plot(ts(pind), y(pind), 'ro');
Réponse acceptée
Star Strider
le 16 Avr 2020
You have the Signal Processing Toolbox, so use the findpeaks function to get the peak amplitudes. It has a number of options so you can be certain to get only the values you want. If you want to get the amplitudes of the ‘valleys’ use findpeaks on the negative value of the signal vector.
10 commentaires
Star Strider
le 18 Avr 2020
I do not understand. If you want to do this in real time, I doubt MATLAB is capable of tha. That might require additional hardware. If so, I will not be able to help you with it.
If you are only interested in recorded signals, there are several functions that might be able to help you with that, including findchangepts, and ischange.
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!