How to find data points within 2% tolerance of curve
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Aiden James
le 30 Avr 2021
Commenté : Chad Greene
le 30 Avr 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.
0 commentaires
Réponse acceptée
Chad Greene
le 30 Avr 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 commentaire
Chad Greene
le 30 Avr 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')
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Descriptive Statistics dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!