필터 지우기
필터 지우기

Do I need to change to floating pts?

조회 수: 1 (최근 30일)
Ehi Eromosele
Ehi Eromosele 2014년 2월 12일
답변: Image Analyst 2014년 2월 12일
%Subscript indices must either be real positive integers or logicals. Error in linearinterp (line 5) plot(x, y, points, y(points), 'r+');%
function linearinterp
x=linspace(-5, 2*pi, 30);
y=exp(-x./2).*sin(x.^2+8);
points = refine(0, 7, 0.6);
plot(x, y, points, y(points), 'r+');
hold on
plot(points, y(points));
hold off
end
function points = refine(x1, x2, tol)
xm = (7)/2;
if abs((0.98935824662+0.01317103434)/2-0.171258585)<tol
points=[x1,x2];
else
left=refine(x1, xm, tol);
right=refine(xm, x2, tol);
points=[left, right(2:length(right))];
end
end

채택된 답변

Image Analyst
Image Analyst 2014년 2월 12일
In y(points) points must be an index 1,2,3,4,5,6,etc. or a logical vector [true, false, false, true, etc.}. It's probably not for you. What is the value of points?

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by