Effacer les filtres
Effacer les filtres

Do I need to change to floating pts?

1 vue (au cours des 30 derniers jours)
Ehi Eromosele
Ehi Eromosele le 12 Fév 2014
%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

Réponse acceptée

Image Analyst
Image Analyst le 12 Fév 2014
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?

Plus de réponses (0)

Catégories

En savoir plus sur Interpolation 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!

Translated by