How to extract the scatter data based on a function
1 次查看(过去 30 天)
显示 更早的评论
回答(1 个)
Image Analyst
2018-7-18
I have no idea what "sign the data" with 0 or 1 means, but to get the data under and above/outside the function, try something like this
indexesUnderTheCurve = false(1, length(x));
for k = 1 : length(x)
thisX = x(k);
thisY = y(k);
curveY = YourFunction(thisX); % Plug the x into your custom function
if thisY < curveY
% Under the curve
indexesUnderTheCurve(k) = true;
end
end
xUnder = x(indexesUnderTheCurve);
yUnder = y(indexesUnderTheCurve);
xOver = x(~indexesUnderTheCurve);
yOver = y(~indexesUnderTheCurve);
5 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!