How to extract the scatter data based on a function

2 visualizaciones (últimos 30 días)
joynjo
joynjo el 18 de Jul. de 2018
Editada: joynjo el 21 de Jul. de 2018
I have a scatter data as attached image follows, how to sign the data outside the function line with '1' and the data under the function line with '0' then save it into one variable?
  1 comentario
joynjo
joynjo el 21 de Jul. de 2018
Up, I am still waiting for anyone who can help me solve this problem, thanks

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 18 de Jul. de 2018
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 comentarios
Image Analyst
Image Analyst el 21 de Jul. de 2018
To help me from transferring all that code, can you attach your m-file?
joynjo
joynjo el 21 de Jul. de 2018
Editada: joynjo el 21 de Jul. de 2018
please kindly find m file for my QDA classification as attached included with the related files.

Iniciar sesión para comentar.

Categorías

Más información sobre Scatter Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by