clc clear all close all % installer le package control: pkg install -forge control % s'assurer de charger le package control pkg load control % ------------------------------------------------------------------------ % Code de generation de diagramme de Bode du circuit % Montage Ampli-op, inverseur avec filtre passe-haut avec limite en F % 1. % % Les valeurs des éléments R et C sont arbitraires :) % % F. Senny - 20/03/2022 % ------------------------------------------------------------------------ % Ampli AC, inverseur avec passe-haut % La fonction calculee est % % R2 RC (jw) % T(jw) = - ---- --------------- % R1 RC (jw) + 1 % % Donc, Cst = -R2/R1, a1 = RC, a0 = 0, b1 = RC, b0 = 1 R2=1e4; % 10 kOhm R1=1e3; % 1 kOhm C=1e-6;% 1 µF Cst=-R2/R1 % wc = 1/R1C = 1e-3 rad/s TAOpHP = Cst*tf([R1*C 0],[R1*C 1]); figure; bode(TAOpHP); title(['Bode Diagram - Amp inverter R_1=1k, R_2=10k, no freq limit']) figure; % ajout de la limite en frequence avec différentes valeurs de R2 fTA=3e6; % par exemple :) R2vec=[1e4 1e3 1e5]; TAOpHP=cell(length(R2vec),1); for i=1:length(R2vec) R2=R2vec(i); B=1/(1+R2/R1) fCT=B*fTA Cst=-R2/R1; % wc = 1/R1C = 1e-3 rad/s TAOpHP{i} = Cst*tf([R1*C 0],[R1*C 1])*tf([1],[1/(2*pi*fCT) 1]); end bode(TAOpHP{1},TAOpHP{2},TAOpHP{3}); % http://www.engandmath.com/Octave_Bode_edit.php h1 = gcf; ax = findall (h1, 'type', 'axes');% Return the handles to all objects of type = axes pl = findall (h1, 'type', 'line');% Return the handles to all objects of type = line legend(ax(3),{'R2=10k','R2=1k','R2=100k'}) legend(ax(1),{'R2=10k','R2=1k','R2=100k'}) title('Bode Diagram - Amp inverter R_1=1k with freq lim')