how to draw vertical lines on the plot?
3 次查看(过去 30 天)
显示 更早的评论
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;
0 个评论
采纳的回答
Walter Roberson
2012-3-14
line([X X], [LowY HighY])
for example,
line([5 5], [0.1 17])
to draw a line from (5,0.1) to (5,17)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spectral Estimation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!