How can I cut the connection between the areas?

조회 수: 1 (최근 30일)
Denis Paul
Denis Paul 2020년 6월 26일
댓글: darova 2020년 6월 27일
Hello,
i am trying to plot the two graphs and fill the area between the two graphs but only if Ventricle < Atrium. I already could fill the are but i want to cut the connection between the areas. Any ideas how I can seperat them?
%Import Data
Druck = readtable("Part1.txt","Delimiter",'space',"DecimalSeparator",",","ReadVariableNames",false);
TabDruck = Druck(:,4:5);
TabDruck.Properties.VariableNames{1} = 'LV';
TabDruck.Properties.VariableNames{2} = 'LA';
Ventricle = (TabDruck{:,"LV"})';
Atrium = (TabDruck{:,"LA"})';
time = 1:length(Ventricle);
condition = (Ventricle < Atrium)';
tcon = time(condition);
Vcon = Ventricle(condition);
Acon = Atrium(condition);
tLiegBed2 = [tcon, fliplr(tcon)];
inBetween = [Vcon, fliplr(Acon)];
%plot
plot(time,Ventricle,'r')
hold on
plot(time,Atrium,'g')
fill(tLiegBed2, inBetween, 'g','Linestyle','none');
hold off

채택된 답변

darova
darova 2020년 6월 26일
Try surf
x = [time; time];
y = [Ventricle; min([Ventricle;Atrium])];
surf(x,y,x*0,'edgecolor','none','facecolor','r')
  댓글 수: 2
Denis Paul
Denis Paul 2020년 6월 26일
Thank you very much. I was looking for the little area so I change your code a little bit.
x = [time; time];
y = [Atrium; min([Ventricle;Atrium])];
surf(x,y,x*0,'edgecolor','none','facecolor','r')
darova
darova 2020년 6월 27일
glad it worked

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Medical Physics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by