Advertisement
Guest User

SDOF Results

a guest
Apr 27th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.14 KB | None | 0 0
  1. function [zi,wn,A,phi,s] = fr1dof(t,r,a,f)
  2.  
  3. %fr1dof SDOF System Paremeters
  4. %   Finds the parameters of a second order 1 DOF system
  5. %   and reconstructs the governing equation.
  6.  
  7. %   Input Arguments
  8. %   t    :  time vector
  9. %   r    :  free response
  10. %   a    :  instant amplitude of the free response
  11. %   f    :  intant frequency (Hz) of the free response
  12.  
  13. %   Output Arguments
  14. %   zi   :  time vector
  15. %   wn   :  free response
  16. %   A    :  instant amplitude of the free response
  17. %   phi  :  intant frequency (rad) of the free response
  18.  
  19. wd = 2*pi*mean(f); % damped frequency
  20.  
  21. s = find(t == 3); e = find(t == 7); % indices to avoid border effects
  22.  
  23. v = zeros(1,size(r,1));
  24. for i = 1:size(r,1)
  25.     amp = polyfit(t(s:e),log(a(i,s:e)),1);
  26.     ziwn(i) = -amp(1); % dampened natural frequency
  27.     % Initial Conditions
  28.     x0 = r(i,1); v(i,:) = diff(r(i,:))./diff(t); v0 = v(i,1);
  29. end
  30.  
  31. wn = sqrt(wd.^2 + ziwn.^2); % natural frequency
  32.  
  33. zi = ziwn./wn; % damping ratio
  34.  
  35. A = sqrt(x0.^2 + ((v0+zi.*wn.*x0)./wd).^2); % amplitude
  36. phi = atan((v0 + zi.*wn.*x0) ./ (wd.*x0)); % phase
  37.  
  38. s = A.*exp(-ziwn.*t).*sin(wd.*t-phi); % reconstructed signal
  39.  
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement