Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. clear all
  2. clf
  3.  
  4. x = [5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24];
  5. y = [0.7, 0.9, 1.4, 1.7, 2.4, 3.1 ,3.5 ,4.8, 5.1, 6.5, 7.5, 8.1, 10.5, 10.3, 13.2, 13.9, 15.1, 18.7, 17.5, 22.7];
  6.  
  7. plot(x, y, 'r-')
  8. # Get the data and plot it;
  9.  
  10. hold on
  11. plot(x, log(y), 'g-')
  12.  
  13. # Now we start fitting
  14. Q = log(y);
  15. A = polyfit(x,Q,1);
  16.  
  17. c=exp(A(2));
  18. d=A(1);
  19. disp('c: '),disp(c)
  20. disp('d: '),disp(d)
  21. disp('A(1)'),disp(A(1))
  22. disp('A(2)'),disp(A(2))
  23.  
  24. hold on
  25. plot(x, A(1).*log(x)+exp(A(2)), 'b-')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement