Borrar filtros
Borrar filtros

how to draw vertical lines on the plot?

2 visualizaciones (últimos 30 días)
Olga
Olga el 14 de Mzo. de 2012
Comentada: Safwaan Kraft el 31 de Mzo. de 2019
Hello, I'm doing HRV spectral analysis and I want draw vertical lines around freq bands on my plot. It'd be great if each area could be in different colour. If anyone could give me any tip, shall be very grateful ;)
I need to add this to this plot:
%Calculate PSD
[PSD,F] = pwelch(odstepRR,128,64,[],fs); %uses a hamming window
VLF = [0.0033 0.04];
LF = [0.04 0.15];
HF = [0.15 0.4];
% find the indexes corresponding to the VLF, LF, and HF bands
iVLF= (F>=VLF(1)) & (F<=VLF(2));
iLF = (F>=LF(1)) & (F<=LF(2));
iHF = (F>=HF(1)) & (F<=HF(2));
% calculate areas, within the freq bands (ms^2)
aVLF=trapz(F(iVLF),PSD(iVLF));
set(handles.vlf, 'string', num2str(aVLF));
aLF=trapz(F(iLF),PSD(iLF));
set(handles.lf, 'string', num2str(LF));
aHF=trapz(F(iHF),PSD(iHF));
set(handles.hf, 'string', num2str(aHF));
aTotal=aVLF+aLF+aHF;
set(handles.tp, 'string', num2str(aTotal));
%calculate LF/HF ratio
lfhf =aLF/aHF;
axes(handles.axes5);
set(handles.text45, 'visible', 'on')
set(handles.axes5, 'visible', 'on')
%plot area under PSD curve
area(F(:),PSD(:),'FaceColor',[.6 .6 .6]);
grid on;

Respuesta aceptada

Walter Roberson
Walter Roberson el 14 de Mzo. de 2012
line([X X], [LowY HighY])
for example,
line([5 5], [0.1 17])
to draw a line from (5,0.1) to (5,17)

Más respuestas (0)

Categorías

Más información sobre Spectral Estimation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by