%% ================= DIAGNOSTYKA PRZEKŁADNI ============== clear all; close all; clc %% 0 | PARAMETRY I DANE load gearbox_1900rpm_70load % zmienna AMC_Test_bench_01_Gearbox fp = 25e3; % [Hz] – częstotliwość próbkowania L_usr = 2; % segmenty do uśredniania FFT f_ob = 1900/60; % [Hz] – prędkość obrotowa wału wejściowego % charakterystyczne rzędy Shaft1 = 1; % rząd 1× Shaft2 = Shaft1/2.91; % ≈ 0.343× GMF = 23; % rząd częstotliwości zazębienia (23 zęby) %% 1 | UŚREDNIANE WIDMO L = floor(size(AMC_Test_bench_01_Gearbox,1)/L_usr); Buf = buffer(AMC_Test_bench_01_Gearbox(:,2), L); Y = abs(fft(Buf,L))/(L/2); if size(AMC_Test_bench_01_Gearbox,1)/L > 2 Y_ave = mean(Y, 2); % średnia po kolumnach else Y_ave = Y; end f = (0:L/2-1).' * fp/L; orders = f / f_ob; % oś rzędów %% 2 | FUNKCJA RYSOWANIA JEDNORAZOWA (pętle, bez definicji func.) % ----- WYKRES 0–80 ------------------------------------------------------- figure('Name','Order spectrum 0–80'); hold on; grid on plot(orders, Y_ave(1:L/2), 'b','LineWidth',2); xlabel('rząd f / f_{rot}'); ylabel('|X| [a.u.]'); title('Widmo rzędów 0 – 80'); xlim([0 80]); set(gcf,'Units','normalized', 'OuterPosition',[0 0 1 1]); xl = xlim; % aktualny zakres osi X % linie wału 1 for h = 1:6 x = h * Shaft1; if x>=xl(1) && x<=xl(2) lab = ''; if h==1, lab='1X'; end xline(x,'k--',lab,'LabelOrientation','horizontal'); end end % linie wału 2 for h = 1:6 x = h * Shaft2; if x>=xl(1) && x<=xl(2) lab = ''; if h==1, lab='sh2'; end xline(x,'m--',lab,'LabelOrientation','horizontal'); end end % GMF + wstęgi boczne ±1, ±2 for harm = 1:3 base = harm * GMF; if base>=xl(1) && base<=xl(2) lab = ''; if harm==1; end xline(base,'r--',sprintf('GMF%d',harm),'LabelOrientation','horizontal'); end for side = [-2 -1 1 2] x = base + side; if x>=xl(1) && x<=xl(2) xline(x,'r--'); end end end % ----- WYKRES 0–10 ------------------------------------------------------- figure('Name','Order spectrum 0–10'); hold on; grid on plot(orders, Y_ave(1:L/2), 'b','LineWidth',2); xlabel('rząd f / f_{rot}'); ylabel('|X| [a.u.]'); title('Widmo rzędów 0 – 10'); xlim([0 10]); set(gcf,'Units','normalized','OuterPosition',[0 0 1 1]); xl = xlim; % nowy zakres osi X % linie wału 1 for h = 1:6 x = h * Shaft1; if x>=xl(1) && x<=xl(2) lab = ''; if h==1; end xline(x,'k--',sprintf('%dX',h),'LabelOrientation','horizontal'); end end % linie wału 2 for h = 1:6 x = h * Shaft2; if x>=xl(1) && x<=xl(2) lab = ''; if h==1; end xline(x,'m--',sprintf('sh%d',h),'LabelOrientation','horizontal'); end end % GMF + prążki boczne ±1, ±2 (tylko te w zakresie) for harm = 1:3 base = harm * GMF; if base>=xl(1) && base<=xl(2) lab = ''; if harm==1, lab='GMF'; end xline(base,'r--',sprintf('%s·%d',lab,harm),'LabelOrientation','horizontal'); end for side = [-2 -1 1 2] x = base + side; if x>=xl(1) && x<=xl(2) xline(x,'r--'); end end end