Plot and fill area enclosed by n lines using Octave\Matlab

浪子不回头ぞ 提交于 2019-12-02 07:11:40

问题


Lets suppose I have n curves, which together enclose some region. How to plot the curves and fill in the region they enclose using Octave/Matlab? Below is example for 3 curves (enclosed area is in black):


回答1:


You can use the function fill.

See the matlab documentation there:

http://www.mathworks.fr/help/techdoc/ref/fill.html




回答2:


I used the fill and flipr functions in matlab to shade the area between two curves:

fill( [x fliplr(x)],  [upper fliplr(lower)], 'c', 'EdgeColor','none'), where x = (1:100)

and 'upper' and 'lower' are variables representing my two traces.

I received help from this post: MATLAB, Filling in the area between two sets of data, lines in one figure



来源:https://stackoverflow.com/questions/8807927/plot-and-fill-area-enclosed-by-n-lines-using-octave-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!