Advertisement
Guest User

Untitled

a guest
Oct 16th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. %% task 4
  2. close all; clear all; clc
  3. % Beam properties & first resonance frequency
  4. L = 1; w = 0.02; h = 0.01; A = w*h;
  5. V = A*L; rho = 7800; m = rho*V;
  6. zeta = 1;
  7. E = 200*10^9; Ix = (w*h^3)/12;
  8. zero1 =fzero('cos(x).*cosh(x)+1',[1,2]);
  9. f0=sqrt(zero1.^4.*E.*Ix./(rho*A))/(2*pi);
  10.  
  11. fs = 10000; % sampling frequency
  12. N = 4; NN = 1024*512;
  13. x = randn(512*1024,1); % creating force input
  14. [B,A] = butter(N, 0.2, 'low');
  15. Y = filter(B,A,x); % filtering signal
  16. win = hann(NN); % Hanning window
  17. [pxx, f] = pwelch(Y, win, NN/2, NN, fs); % calculating PSD
  18. figure()
  19. semilogy(f, pxx); xlim([0 1000]); title('PSD - N=1024*512 (Filtered force)');
  20. xlabel('Frequency [Hz]'); ylabel('PSD log_1_0[N^2/Hz]')
  21.  
  22. % Calculating rms
  23. pxx_rms = rms(pxx)
  24. F_rms = rms(Y)
  25.  
  26.  
  27. N = 16384; %FFT size
  28. win = hann(N); % hanning window
  29. OL = N/2; % overlap
  30. df = fs/N;
  31. f = 0:df:N*df-df; % frequency vector
  32. xin = 1;
  33. N_modes = 5;
  34.  
  35. for i = 1:10
  36. xout = (i-1)/10;
  37. [poles(:,i), residues(:,i)] = cantilever(m, f0, xin, xout, N_modes, zeta); % Calculating poles/residues
  38. [y(:,i),t(:,i)] = timeresv_rp(Y,fs,residues(:,i),poles(:,i),(1:N_modes)); % Time response/ time vector
  39. FRF(:,i) = tfestimate(t(:,i), y(:,i), win , N/2, N); % Calculating transfer function
  40.  
  41. figure()
  42. semilogy(f(1:length(FRF(:,i))), abs(FRF(:,i))); xlim([0 1000])
  43. end
  44.  
  45. xout = 1;
  46. [pole, residue] = cantilever(m, f0, xin, xout, N_modes, zeta);
  47. [y1,t1] = timeresv_rp(Y,fs,residue,pole,(1:N_modes));
  48. [H,f1] = tfestimate(t1, y1, win , N/2, N, fs);
  49. figure()
  50. semilogy(f1, abs(H)); xlim([0 1000])
  51.  
  52.  
  53. [coherence, f_coh] = mscohere(Y, y(:,10),[],[],[], fs); % Calculating coherence
  54. figure()
  55. plot(f_coh, coherence); xlim([0 1000])
  56. title('Coherence \gamma^2'); xlabel('Frequency [Hz]'); ylabel('Coherence');
  57. % w = f1.*(2*pi);
  58. % s = (j*w);
  59. % HM = H.*s;
  60. % mif = modeind1(HM);
  61. % figure()
  62. % plot(f1, mif);xlim([0 100])
  63. %
  64. % [h,t,fs] = impresp(H,f1);
  65. % hN = 2000; N = 25; flow = 0; fhi = 1000;
  66. % poles = complexp(h,fs,hN,N,mif,f1,flow,fhi);
  67.  
  68.  
  69. %[residues,residuals] = pol2resf(H,f,poles,flow,fhi,disptime)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement