Advertisement
Guest User

linear

a guest
Jul 20th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. clear
  2. clc
  3.  
  4. x = 0:6;
  5. y = [0 .8415 .9093 .1411 -.7568 -.9589 -.2794];
  6. n = length(x);
  7. xL = linspace(0,6,606);
  8. yI = zeros(1,length(xL));
  9. c = 1;
  10.  
  11. for i = 1:n-1
  12. eqn = [ (y(i+1)-y(i))/(x(i+1)-x(i)) (x(i+1)*y(i)-x(i)*y(i+1))/(x(i+1)-x(i)) ];
  13. for xx = x(i):.01:x(i+1)
  14. yI(c) = polyval(eqn,xx);
  15. c=c+1;
  16. end
  17. end
  18.  
  19.  
  20. plot(x,y,'o');
  21. hold on;
  22. plot(xL,yI);
  23. xp=2.5;
  24.  
  25. grid;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement