How to create plots for special areas of an array?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Stwiwi
el 12 de Sept. de 2018
Comentada: Stwiwi
el 17 de Sept. de 2018
Dear people,
I have a plot like this:
I want to plot each of the four waves separately. Of course I could just divide the whole length by 4 but then there would still be the noise from between the big waves. I tried to create a new array where all values smaller than 0.03 are deleted. But then I also delete those values of the big waves as well. Does anybody has an idea how to solve this? Thank you very much:)
5 comentarios
Respuesta aceptada
Star Strider
el 13 de Sept. de 2018
The Code —
D = load('005a_100Hz.mat');
Ch9 = D.Channel_9_Data;
tv = D.Channel_1_Data; % Time Vector
[lpt,rsd] = findchangepts(Ch9, 'Statistic','rms', 'MaxNumChanges',8);
for k1 = 1:2:numel(lpt)-1
sig_seg{(k1+1)/2,1} = Ch9(lpt(k1):lpt(k1+1)); % Signal Values At Each Segment
sig_seg{(k1+1)/2,2} = lpt(k1):lpt(k1+1); % Index Range
end
vl = bsxfun(@times, ones(numel(lpt), 2), [min(Ch9) max(Ch9)]); % Create Vertical Lines For ‘figure(1)’
figure(1)
plot(tv, Ch9)
hold on
plot([tv(lpt),tv(lpt)]', vl', '-r', 'LineWidth',1.5)
hold off
grid
figure(2)
for k1 = 1:size(sig_seg,1)
subplot(size(sig_seg,1), 1, k1)
plot(tv(sig_seg{k1,2}), sig_seg{k1,1})
xlabel('Time (s)')
grid
end
The Plots —
3 comentarios
Más respuestas (2)
Image Analyst
el 12 de Sept. de 2018
What I would do is to scan the signal with a filter to detect the large variations zones, like with movmax(), imdilate(), stdfilt() or similar. Then I'd threshold to find the "quiet" low signal areas. Then I'd find the centroid of those zones, assuming you want to split the signal in the middle of the quiet zones, with the regionprops() function (in the Image Processing Toolbox). I have done this exact thing for a nearly identical signal someone had a couple of years ago. Attach your data if you want any more help.
0 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!