matlab - 直线和绘图之间的阴影区域

标签 matlab matlab-figure

我已经彻底搜索了网络,但仍然没有找到确切的解决方案。我需要在 MATLAB 中对直线上方和绘图下方的相交区域进行着色。

image

我需要对阈值 110 以上和绘图下方的区域进行着色。

最佳答案

这是使用区域的方法:

% generate "data"
    x=1:100;
    y1=0.5*ones(100,1);
    y2=exp(-(x(:)-50).^2/500).^.5+0.1*rand(100,1);

% do the plot

    h=area([y1(:) , (y2(:)-y1(:)).* (y2(:)>y1(:)) ]);
    h(1).FaceColor=[1 1 1];
    h(2).FaceColor=[0 0 1 ];
    hold on;

    plot(x,y2,'b',x,y1,'r');

enter image description here

关于matlab - 直线和绘图之间的阴影区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66074491/

相关文章:

matlab - 我如何在 MATLAB 中随机选择矩阵的每一列中的一个元素?

matlab - 绘制使用 "quiver"时的域

matlab - 在 Matlab 中使用 bar3 时如何设置 x 和 y 值?

MATLAB 误差线线条样式

python - 什么是 numpy.fft.rfft 和 numpy.fft.irfft 及其在 MATLAB 中的等效代码

matlab - Fminsearch Matlab(非线性回归)

Matlab:当我放大 plotyy 图时,yTicks 不会自动更新

matlab - 如何关闭MATLAB中的所有神经网络图?

matlab - 如何在 matlab 中以非交互方式使用 cftool

matlab - 绘制 3D 线,matlab