⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flowgraph_1.asv

📁 spread spectrum communication will be helpful to you!
💻 ASV
字号:
% Solutions to flowgraph problems using the Symbolic Toolbox
% Flowgraphs are a staple of s-paraameter based network analysis. 
% Although there are "simple" rules (Sam Mason, MIT) for their analysis, 
% even simple rules can be forgotten as time passes.  The symbolic toolbox 
% is a great tool for analyzing flowgraphs, and no "rules" need apply. It 
% is simply a matter of writing the equations for the flowgraph in an
% orderly manner, and using the "solve" function of the symbolic toolbox to
% do the tedious and error prone algebra. 
%
% TRhe notation used in this example is as follows: 
%     summing node: O
%     signal flow : > < V ^    (right, left, down, up)
%     signal node : *
%     branches without a coefficient:  default "gain" = 1
%
% 
%   As a first example, consider a simple feedback topology .... 
%
%                x1
%      u*--K->---O---G->----*----*y
%                |          |
%                ---<-(-H)--- 
%
%     The goal is to solve for output y in terms of input u and parameters K,G,H


% start by defining symbols ..
syms u y K G H x1 
% then write the two equations
eq1 =  x1*G - y;         % y  = G*x1
eq2 = -H*y + K*u - x1;   % x1 = K*u - H*y

solution_1 = solve(eq1,eq2,x1,y);  % use the solve function on the equations
disp('answer to problem 1: ')
y = solution_1.y      % solution for y in terms of input x 
                      %  y = K*u/(H*G+1)*G

% That was a simple example that could have easily be worked by hand. 
% For a more chalenging case, consider the error factors (Exy) involved with  S parameter measurements (Sxy)
%       a1 = incident, b1 = reflected, b2 = transmitted  (power)
%
%                -------------------------  Exf->------------------------------
%                |                                                             |
%                |                    x1                        x3             |
%      a1*---->--*--->-----O--->------*-----S21->-----O---->----*-----Etf->----O------*b2
%                |         |          |               |         |
%                V Edf     ^ Esf      V S11           ^ S22     V Elf
%                |         |          |               |         |
%      b1*--<----O--<-Erf--*--<-------O-----<-S12-----*----<----O     
%                          x4                         x2
%
%      solve for outputs b1 and b2 in terms of input a1
%

syms a1 b1 b2 Edf Erf Esf S11 S21 S22 S12 Elf Etf Exf x1 x2 x3 x4

eq1 = Esf*x4 + a1     - x1;     %  x1 = Esf*x4 + a1        
eq2 = Elf*x3          - x2;     %  x2 = Elf*x3
eq3 = S21*x1 + S22*x2 - x3;     %  x3 = S11*x1 + S22*x2
eq4 = S11*x1 + S12*x2 - x4;     %  x4 = S11*x1 + S12*x2 
eq5 = Erf*x4 + Edf*a1 - b1;     %  b1 = Erf*x4 + Edf*a1
eq6 = Etf*x3 + Exf*a1 - b2;     %  b2 = Etf*x3 + Exf*a1

solution = solve(eq1,eq2,eq3,eq4,eq5,eq6,x1,x2,x3,x4,b1,b2);
b1=solution.b1 
b2=solution.b2   

% in case you do not have the symbolic Toolbox, the solution is : 
% b1 = a1*(Erf*S21*S12*Elf-Erf*S22*Elf*S11+Erf*S11-Edf*S21*Esf*S12*Elf+Edf*S22*Elf*S11*Esf-Edf*S22*Elf-Edf*S11*Esf+Edf)/(-S21*Esf*S12*Elf+S22*Elf*S11*Esf-S22*Elf-S11*Esf+1)
% b2 = a1*(Etf*S21-Exf*S21*Esf*S12*Elf+Exf*S22*Elf*S11*Esf-Exf*S22*Elf-Exf*S11*Esf+Exf)/(-S21*Esf*S12*Elf+S22*Elf*S11*Esf-S22*Elf-S11*Esf+1)
% The chances of getting this answer correct is slim to none for most of us mortals ! 

% Dick Benson, The Mathworks

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -