フィルターのクリア

How I ignore the unnecessary areas between two graphs in my Plot?

2 ビュー (過去 30 日間)
Denis Paul
Denis Paul 2020 年 6 月 29 日
コメント済み: Shojiro SHIBAYAMA 2020 年 6 月 29 日
Hello,
I want to color the areas between the two graphs like it is. The interesting part is the big green area. Sometimes i get a little green area between the big areas. My question is "How i can ignore the little areas"?
Pressure = readtable("Part1.txt","Delimiter",'space',"DecimalSeparator",",","ReadVariableNames",false);
Tabpressure = Pressure(:,4:5);
Tabpressure.Properties.VariableNames{1} = 'LV';
Tabpressure.Properties.VariableNames{2} = 'LA';
Ventricel = (Tabpressure{:,"LV"})';
Atrium = (Tabpressure{:,"LA"})';
Time = (1:length(Ventricel));
plot(Time,Ventricel,'r',"LineWidth",1);
hold on
plot(Time,Atrium,'g',"LineWidth",1);
Timearea = [Time; Time];
BothCurves = [Atrium; min([Ventricel;Atrium])];
surf(Timearea,BothCurves,Timearea*0,'edgecolor','none','facecolor','g');
hold off
  1 件のコメント
darova
darova 2020 年 6 月 29 日
I think solution would too complicated. What about this simple trick?
BothCurves = [Atrium-1000; min([Ventricel;Atrium-1000])];

サインインしてコメントする。

回答 (1 件)

Shojiro SHIBAYAMA
Shojiro SHIBAYAMA 2020 年 6 月 29 日
編集済み: Shojiro SHIBAYAMA 2020 年 6 月 29 日
How about you ignore the indexes of both x `Time` and y `Ventricel` and `Atrium`?
Define `THRESHOLD` as you wish and you recognize as 'ignorable'.
onFocus = Atrium >= Ventricel & abs(Atrium - Ventricel) >= THRESHOLD;% returns boolean
So the final code will be:
Pressure = readtable("Part1.txt","Delimiter",'space',"DecimalSeparator",",","ReadVariableNames",false);
Tabpressure = Pressure(:,4:5);
Tabpressure.Properties.VariableNames{1} = 'LV';
Tabpressure.Properties.VariableNames{2} = 'LA';
Ventricel = (Tabpressure{:,"LV"})';
Atrium = (Tabpressure{:,"LA"})';
onFocus = Atrium >= Ventricel & abs(Atrium - Ventricel) >= THRESHOLD;% returns boolean
Time = (1:length(Ventricel));
plot(Time(onFocus),Ventricel(onFocus),'r',"LineWidth",1); % keep onFocus==true variables
hold on
plot(Time(onFocus),Atrium(onFocus),'g',"LineWidth",1); % keep onFocus==true variables
Timearea = [Time; Time];
BothCurves = [Atrium; min([Ventricel;Atrium])];
surf(Timearea,BothCurves,Timearea*0,'edgecolor','none','facecolor','g');
hold off
Good luck!
  2 件のコメント
madhan ravi
madhan ravi 2020 年 6 月 29 日
I revived your answer from spam quarantine. Perhaps it’s because you used those apostrophes it may have gone to the spams.
Shojiro SHIBAYAMA
Shojiro SHIBAYAMA 2020 年 6 月 29 日
Okay, thank you! I'm used to markdown grammar and tend to use apostrophes. I'll avoid them in future.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by