How to find data points within 2% tolerance of curve
조회 수: 2 (최근 30일)
이전 댓글 표시
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
채택된 답변
Chad Greene
2021년 4월 30일
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
Chad Greene
2021년 4월 30일
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')
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Descriptive Statistics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!