blc.m
来自「Branch line coupler design using Matlab」· M 代码 · 共 56 行
M
56 行
% Lab Assignment 2...
% Aim of the Assignment -> Quadrature Hybrid
% Submitted by:
% Akhilesh Kumar Misra (991202)
% Gaurav Singh (991210)
k=input('Enter the length to lambda ratio ');
Z0=input('Enter the value of Zo : ');
Za=input('Enter the value of Za : ');
Zb=input('Enter the value of Zb : ');
% f->the frequency in Ghz
f=.3*k; % f is taken into Ghz
f=f/2:1/5000:3*f/2;
Ya=1/Za; Yb=1/Zb; Y0=1/Z0;
c=.3; lambda=c./f; % c is speed of light
x=cos(2*pi./lambda); y=sin(2*pi./lambda);
Toue=j*(Y0*Za*y-Z0*Yb*x-Z0*Ya*y+Z0*Za*Yb*Yb*y-Z0*Yb*x)./((2*x-2*Za*Yb*y)+j*(Y0*Za*y+Z0*Yb*x+Z0*Ya*y-Z0*Za*Yb*Yb*y+Z0*Yb*x));
Touo=j*(Y0*Za*y+Z0*Yb*x-Z0*Ya*y+Z0*Za*Yb*Yb*y+Z0*Yb*x)./((2*x+2*Za*Yb*y)+j*(Y0*Za*y-Z0*Yb*x+Z0*Ya*y-Z0*Za*Yb*Yb*y-Z0*Yb*x));
Transe=2./((2*x-2*Za*Yb*y)+j*(Y0*Za*y+Z0*Yb*x+Z0*Ya*y-Z0*Za*Yb*Yb*y+Z0*Yb*x));
Transo=2./((2*x+2*Za*Yb*y)+j*(Y0*Za*y-Z0*Yb*x+Z0*Ya*y-Z0*Za*Yb*Yb*y-Z0*Yb*x));
% so the S parameters of the scattering matrix
s11=(Toue+Touo)/2;
s12=(Transe+Transo)/2;
s13=(Transe-Transo)/2;
s14=(Toue-Touo)/2;
figure;
plot(f,10*log10(abs(s11)),'r');
hold on;
plot(f,20*log10(abs(s12)),'b');
plot(f,20*log10(abs(s13)),'k');
plot(f,20*log10(abs(s14)),'m');
xlabel('frequency')
ylabel('parameters (in db)')
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?