Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [zi,wn,A,phi,s] = fr1dof(t,r,a,f)
- %fr1dof SDOF System Paremeters
- % Finds the parameters of a second order 1 DOF system
- % and reconstructs the governing equation.
- % Input Arguments
- % t : time vector
- % r : free response
- % a : instant amplitude of the free response
- % f : intant frequency (Hz) of the free response
- % Output Arguments
- % zi : time vector
- % wn : free response
- % A : instant amplitude of the free response
- % phi : intant frequency (rad) of the free response
- wd = 2*pi*mean(f); % damped frequency
- s = find(t == 3); e = find(t == 7); % indices to avoid border effects
- v = zeros(1,size(r,1));
- for i = 1:size(r,1)
- amp = polyfit(t(s:e),log(a(i,s:e)),1);
- ziwn(i) = -amp(1); % dampened natural frequency
- % Initial Conditions
- x0 = r(i,1); v(i,:) = diff(r(i,:))./diff(t); v0 = v(i,1);
- end
- wn = sqrt(wd.^2 + ziwn.^2); % natural frequency
- zi = ziwn./wn; % damping ratio
- A = sqrt(x0.^2 + ((v0+zi.*wn.*x0)./wd).^2); % amplitude
- phi = atan((v0 + zi.*wn.*x0) ./ (wd.*x0)); % phase
- s = A.*exp(-ziwn.*t).*sin(wd.*t-phi); % reconstructed signal
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement