Advertisement
cyphric

Untitled

Oct 19th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.47 KB | None | 0 0
  1. %Uppgift 3, Anton Hagelberg och Filip Johansson, fjäderkonstanter
  2. clear all; clc; close all;
  3. k = [5300,163000]';
  4. kn = 0;
  5. tol = 1e-6;
  6. error = [tol*2,tol*2]';
  7. ck = 0.7;
  8. NR = [k(1),k(2)]';
  9. cs = 1;
  10. n = 1;
  11.  
  12. while error(:,n) > tol
  13.    
  14.     F = transfer_functions(k(1),k(2),ck,cs);
  15.     J = Jacobian_transfer_functions(k(1),k(2));
  16.    
  17.     kn = k - J\F;
  18.    
  19.     k = kn;
  20.     NR = [NR, k];
  21.     error = [error, abs(NR(:,n+1) - NR(:,n))];
  22.    
  23.     n = n + 1;
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement