how to identify the points below a line in a graph using MATLAB?

故事扮演 提交于 2019-12-24 05:47:32

问题


After running the program, I got 14 values of loglik, then I plotted these value within two lines. The code is below:

loglik=[-3168.7176,-4644.451,-3759.7372,-1758.1307,-4813.0647,-4147.0188,...
        -4330.944,-4612.9895,-3829.8987,-2687.4927,...
        -4007.5629,-2799.527,-2747.96,4.386];
aH = axes;
plot(aH,loglik,'r.'); hold on;
threshold1=mean(loglik)+1*std(loglik);
threshold2=mean(loglik)+3*std(loglik);
plot(aH, aH.XLim, [threshold2, threshold2], 'r-');
plot(aH, aH.XLim, [threshold1, threshold1], 'r-');

Now, I want to identify the points which are below threshold1. How can I do that?


回答1:


This will distinguish visually between the points above\below threshhold1:

plot(aH,loglik(loglik>=threshold1),'r.');
hold on;
plot(aH,loglik(loglik<threshold1),'b.');

Points above (or equal to) threshhold1 are red, and below are blue.



来源:https://stackoverflow.com/questions/38178320/how-to-identify-the-points-below-a-line-in-a-graph-using-matlab

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