📄 gp_circles.m
字号:
function gp_circles(s, values)%GP_CIRCLES Draw constant operating power gain circles on a Smith Chart.% GP_CIRCLES(S, VALUES) has the following parameters: % - S: a 2x2 matrix containing the s-parameters of the device, and% - VALUES: the power values to be plotted in dB.% If VALUES is not provided, four circles are drawn from MAG or MSG in% steps of 1 dB.%% Example:% % The operating power gain circles in Figure 3.7.3 in Gonzalez.% s = [ (0.5*exp(-j*180/180*pi)) (0.08*exp( j* 30/180*pi)) ; ...% (2.5*exp( j* 70/180*pi)) ( 0.8*exp(-j*100/180*pi)) ]% smith% gp_circles(s, [ 30 20 15 10 0 ])%% See also: SMITH, SMICIRC %% Reference:% G. Gonzalez, "Microwave Transistor Amplifiers - Analysis and Design,"% 2nd ed., Prentice Hall, 1997.% Copyright 2008 Warren du Plessis%% This file is part of The Smith Chart Circles Toolbox.%% The Smith Chart Circles Toolbox is free software: you can redistribute it% and/or modify it under the terms of the GNU General Public License as% published by the Free Software Foundation, either version 3 of the% License, or (at your option) any later version.%% The Smith Chart Circles Toolbox is distributed in the hope that it will be% useful, but WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General% Public License for more details.%% You should have received a copy of the GNU General Public License along% with The Smith Chart Circles Toolbox. If not, see% <http://www.gnu.org/licenses/>.% Check the number of inputs.error(nargchk(1, 2, nargin));% Calculate the values of the 4 default circles to be plotted if no gains% are specified.if nargin < 2 values = maximum_gain(s) - [ 1e-4 1 2 3 ];end% Check the s-parameter matrix has the correct size.if ~isequal(size(s), [ 2 2 ]) error('The s-parameter matrix must be a 2x2 matrix.');end% Add these circles to the current plot.hold on% Calculate the Rollett stability factor.delta = s(1,1)*s(2,2) - s(1,2)*s(2,1);K = (1 - abs(s(1,1))^2 - abs(s(2,2))^2 + abs(delta)^2)/ ... abs(2*s(1,2)*s(2,1));% Determine the centres and radii of the circles.gp = 10.^(values/10)/abs(s(2,1))^2; % Divide by abs(s(2,1))^2 here to save % computations below.centre = gp*conj(s(2,2) - delta*conj(s(1,1)))./ ... (1 + gp*(abs(s(2,2))^2 - abs(delta)^2));radius = sqrt(1 - 2*K*abs(s(1,2)*s(2,1))*gp + (abs(s(1,2)*s(2,1))*gp).^2)./ ... (1 + gp*(abs(s(2,2))^2 - abs(delta)^2));% Plot the circles.smith_circles(centre, abs(radius), 'm')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -