% Matlab 程式設計 基礎篇,葉倍宏 編著,全華 % Matlab 程式設計 應用篇,葉倍宏 編著,全華 % 以下程式摘自以上書籍,敬請多多選購。 (書中含大量實用範例) % BJT Network (frequency response): 淹沒CE amp. %input clear; vcc=20; rs = 1000; r1 = 40000; r2 = 10000; rc = 4000; re = 2000; rl = 2200; c1 = 10; c1 = c1*10^-6; c2 = 1; c2 = c2*10^-6; beta = 100; % beta value cbe = 20; cbe=cbe*10^-12; cbc = 3; cbc=cbc*10^-12; cce = 5; cce=cce*10^-12; % r'e vth = vcc*r2/(r1+r2); rth = parl2(r1,r2); IE = (vth-0.7)/(re+rth/(beta+1)); rep = 25/(IE*1000); % f = logspace(-1,9); zc1 = 1./(j*2*pi*f.*c1); zc2 = 1./(j*2*pi*f.*c2); % input impedence zinb = beta*(rep+re); zin = parl2(rth,zinb); % bjt:gain A = -rc./(rep+re); rcl = parl2(rc,rl); Av = -rcl./(rep+re); % miller theory cinm = cbc*(1-Av); cin = cinm+cbe; coutm = cbc*(1-Av)/-Av; cout = coutm+cce; % output impedence zout = rc; % cutoff frequency fc1 = 1./(2*pi*(rs+zin)*c1); fc2 = 1/(2*pi*(zout+rl)*c2); if fc1>fc2 fc = fc1; else fc = fc2; end % cal atl1 = zin./(rs+zc1+zin); % low f part atl3 = rl./(zout+zc2+rl); atl = atl1.*A.*atl3; atpl = 20*log10(abs(atl)); rszin = parl2(rs,zin); % high f part zoutrl = parl2(zout,rl); zcin = 1./(j*2*pi*f.*cin); zcout = 1./(j*2*pi*f.*cout); ath1 = zcin./(rszin+zcin); ath3 = zcout./(zoutrl+zcout); ath = ath1.*ath3; atph = 20*log10(abs(ath)); atp = atpl+atph; % combination % plotting 頻率-增益圖 以及 頻率-相位圖 close; subplot(2,1,1); semilogx(f,atp,'r-'); grid on; axis([1.0e-1 1.0e9 -100 0]); xlabel('f (Hz)'); ylabel('At (dB)'); subplot(212); semilogx(f,(angle(atl)+angle(ath)).*57.3,'g-'); grid on; xlabel('f (Hz)'); ylabel('angle'); axis([1.0e-1 1.0e9 -360 0]);