How to obtain each each maximum value from each signal set?
20 次查看(过去 30 天)
显示 更早的评论
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 个评论
Peng Li
2020-4-30
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');
采纳的回答
Star Strider
2020-4-16
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 个评论
Star Strider
2020-4-18
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Continuous Waveforms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!