diff --git a/MOD2-files/EXP6/Experiment6_filter.m b/MOD2-files/EXP6/Experiment6_filter.m index ecb7981..ff81db9 100644 --- a/MOD2-files/EXP6/Experiment6_filter.m +++ b/MOD2-files/EXP6/Experiment6_filter.m @@ -1,18 +1,3 @@ -clear; -clc; - -fprintf('Bodediagram of the filter\n\n'); - -R2 = input('R2 [Ohm] : '); -R3n = input('R3:[kOhm] : '); -C4n = input('C4 [nF] : '); -L5n = input('L5 [mH] : '); -fprintf('\n'); - -R3 = R3n*1e3; -C4 = C4n*1e-9; -L5 = L5n*1e-3; - t0 = 0; t1 = L5; n0 = R2+R3; diff --git a/OOequipment/FourierFilterAnalysis.mlx b/OOequipment/FourierFilterAnalysis.mlx new file mode 100644 index 0000000..d040f33 Binary files /dev/null and b/OOequipment/FourierFilterAnalysis.mlx differ diff --git a/OOequipment/FourierHarmonics.mlx b/OOequipment/FourierHarmonics.mlx index d6f91eb..f503d54 100644 Binary files a/OOequipment/FourierHarmonics.mlx and b/OOequipment/FourierHarmonics.mlx differ diff --git a/OOequipment/subfiles/FourierFilterAnalysis_script.m b/OOequipment/subfiles/FourierFilterAnalysis_script.m new file mode 100644 index 0000000..ff81db9 --- /dev/null +++ b/OOequipment/subfiles/FourierFilterAnalysis_script.m @@ -0,0 +1,38 @@ +t0 = 0; +t1 = L5; +n0 = R2+R3; +n1 = L5; +n2 = n0*C4*L5; + +fstep = 4; +f=596; + +for i=1:251 + f = f + fstep; + frequentie(i) = f; + w = 2*pi*f; + H(i)=((1i*w*t1)/(n0+1i*w*n1+n2*(1i*w)^2)); +end + +figure(1); +fig_label=('Bodediagram Fourierfilter'); +set(clf,'PaperType','A4'); +set(clf,'Color',[1,1,1]); +subplot(211); +semilogx(frequentie, abs(H)) +axis([600 1600 0.0 1.2]) +ylabel('amplitude','Fontsize',10) +hndl=title(fig_label,'Fontsize',10,'Fontweight','bold'); +h=get(hndl); +set(gca, 'XTick', [600 700 800 900 1000 1100 1200 1300 1400 1500 1600],'Fontsize',8) +set(gca, 'YTick', [0.0 0.2 0.4 0.6 0.8 1.0 1.2],'Fontsize',8) +grid; + +subplot(212); +semilogx(frequentie, angle(H)/pi) +axis([600 1600 -0.6 0.6]) +xlabel('frequency [Hz]','Fontsize',10) +ylabel('phase [rad]','Fontsize',10) +set(gca, 'XTick', [600 700 800 900 1000 1100 1200 1300 1400 1500 1600],'Fontsize',8) +set(gca, 'YTick', [-0.6 -0.4 -0.2 0.0 0.2 0.4 0.6],'Fontsize',8) +grid; diff --git a/OOequipment/subfiles/FourierHarmonics_script.m b/OOequipment/subfiles/FourierHarmonics_script.m index f6db58f..5025289 100644 --- a/OOequipment/subfiles/FourierHarmonics_script.m +++ b/OOequipment/subfiles/FourierHarmonics_script.m @@ -18,30 +18,30 @@ mA=ceil(maxamp); figure(1); set(clf,'PaperType','A4'); set(clf,'Color',[1,1,1]); -subplot(221); +ax(1) = subplot(221); plot(tv, blv, tv, ehv, tv, dhv, tv, vhv); xlabel('time [ms]','Fontsize',8); title('first three harmonics','Fontsize',8); set(gca,'Fontsize',8); -subplot(222); +ax(end+1) = subplot(222); plot(tv, blv, tv, ehv); xlabel('time [ms]','Fontsize',8); title('first harmonic','Fontsize',8); set(gca,'Fontsize',8); -subplot(223); +ax(end+1) = subplot(223); plot(tv, blv, tv, epdhv); xlabel('time [ms]','Fontsize',8); title('sum first and third harmonic','Fontsize',8); set(gca,'Fontsize',8); -subplot(224); +ax(end+1) = subplot(224); plot(tv, blv, tv, epdpvhv); xlabel('time [ms]','Fontsize',8); title('sum of all harmonics','Fontsize',8); set(gca,'Fontsize',8); - +linkaxes(ax) %% Triangular Wave amp = -(8*B)/(pi^2); @@ -70,26 +70,29 @@ epdpvhv = epdhv + vhv; figure(2); set(clf,'PaperType','A4'); set(clf,'Color',[1,1,1]); -subplot(221); +ax(end+1) = subplot(221); plot(tv, drv, tv, ehv, tv, dhv, tv, vhv); xlabel('time [ms]','Fontsize',8); title('first three harmonics','Fontsize',8); set(gca,'Fontsize',8); -subplot(222); +ax(end+1) = subplot(222); plot(tv, drv, tv, ehv); xlabel('time [ms]','Fontsize',8); title('first harmonic','Fontsize',8); set(gca,'Fontsize',8); -subplot(223); +ax(end+1) = subplot(223); plot(tv, drv, tv, epdhv); xlabel('time [ms]','Fontsize',8); title('sum first and third harmonic','Fontsize',8); set(gca,'Fontsize',8); -subplot(224); +ax(end+1) = subplot(224); plot(tv, drv, tv, epdpvhv); xlabel('time [ms]','Fontsize',8); title('sum of all harmonics','Fontsize',8); -set(gca,'Fontsize',8); \ No newline at end of file +set(gca,'Fontsize',8); + +linkaxes(ax(5:8)) +arrayfun(@(x) set(x,{'XGrid','YGrid'},{'on','on'}),ax) \ No newline at end of file