How to find data points within 2% tolerance of curve

4 visualizaciones (últimos 30 días)
Aiden James
Aiden James el 30 de Abr. de 2021
Comentada: Chad Greene el 30 de Abr. de 2021
Suppose, I have any curve , assume y=x^2 . And I have some scatter data points(X,Y) . Then , how to find scattter data points which are in 2% tolerance of curve y=x^2.

Respuesta aceptada

Chad Greene
Chad Greene el 30 de Abr. de 2021
Sounds like a nice homework problem.
You'll probably want to use logical indexing to find the indices of the Y data that are within some range of your predicted y curve.
If you wanted to find the indices of all Y values that are greater than 3 and less than 5, you'd do
ind = y>3 & y<5;
which would return true for all of the y values that are within that range.
Now try the same logic, but find the indices of all Y points that are greater than 0.98 of your x^2 curve, and less than 1.02.
  1 comentario
Chad Greene
Chad Greene el 30 de Abr. de 2021
Here's an example.
X = 1:100;
Y = 10*rand(100,1);
plot(X,Y,'.','color',0.8*[1 1 1])
Now the indices of all the Y data between 3 and 5:
ind = Y>3 & Y<5;
hold on
plot(X(ind),Y(ind),'ro')

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Fit Postprocessing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by