Shade area between two curves

62 ビュー (過去 30 日間)
Martina Clairand
Martina Clairand 2021 年 8 月 14 日
コメント済み: Martina Clairand 2021 年 8 月 14 日
Hello,
I'm trying to fill the area between these two curves:
I have tried to use the jbfill.m function and to create a poligon for filling it without succes:
Any idea on how to fix the problem?
Thank you in advance for your help! (ps: I attach the .mat files of x and upper and lower curves)

採用された回答

Simon Chan
Simon Chan 2021 年 8 月 14 日
Use function fill
clear; clc;
load('xdata1.mat');
load('up.mat');
load('low.mat');
coord_up = [xdata1,up];
coord_low = [xdata1,low];
coord_combine = [coord_up;flipud(coord_low)];
fill(coord_combine(:,1),coord_combine(:,2),'b')
  1 件のコメント
Martina Clairand
Martina Clairand 2021 年 8 月 14 日
Awesome! Thank you

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

その他の回答 (2 件)

Matt J
Matt J 2021 年 8 月 14 日
編集済み: Matt J 2021 年 8 月 14 日
For example,
x=linspace(0,2).';
yhigh=(x-1).^2+1;
ylow=-x+0.5;
h=area([ylow,yhigh]);
set(h(1),'FaceColor','w','EdgeColor','none')

Image Analyst
Image Analyst 2021 年 8 月 14 日
See the FAQ, not only for this very FAQQY question but for lots of other good information too:

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by