Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function y = linterp(xp,yp, x )
- %UNTITLED2 Summary of this function goes here
- % Detailed explanation goes here
- n = length(xp);
- m = length(x);
- for k = 1:m
- y(k)= 0;
- for i = 1:n
- p = yp(i);
- for j= 1 : n
- if i~=j
- p=p*(x(k)-xp(j)) / (xp(i)-xp(j));
- end
- end
- y(k) = y(k)+p;
- end
- end
- end
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- x = [ 1.1 2.1 3.1 3.5];
- xp = [1 2 3 4];
- yp = [3.3 10.7 22.3 38.1];
- xxx = linterp(xp,yp, x )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement