Borrar filtros
Borrar filtros

How to obtain each each maximum value from each signal set?

25 visualizaciones (últimos 30 días)
Chen Kevin
Chen Kevin el 16 de Abr. de 2020
Comentada: Peng Li el 30 de Abr. de 2020
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 comentarios
Chen Kevin
Chen Kevin el 20 de Abr. de 2020
Hi Peng Li,
May I hear about how do you use "threshold" way to find the max value from each wave sets? Maybe using "if" function?
Here is the signal code:
%Generate signal
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])
Peng Li
Peng Li el 30 de Abr. de 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');

Iniciar sesión para comentar.

Respuesta aceptada

Star Strider
Star Strider el 16 de Abr. de 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 comentarios
Chen Kevin
Chen Kevin el 17 de Abr. de 2020
What I have considered method by used for and if function is :
  1. Set a threshold for switch on and switch off record the data
  2. Once the amplitude (y>threshold) which means the cell just enter the sensing zone, start the record
  3. When the amplitude (y<threshold) which means the cell almost leave the zone, stop recording
  4. Find the max value from this recording time interval
  5. The width can be get when the time interval calculated
However, I am quite fresh in Matlab so don't know how to wirte down them...
Star Strider
Star Strider el 18 de Abr. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by