mstripr.m

来自「用matlab编写的电磁学方面的函数和图像」· M 代码 · 共 45 行

M
45
字号
% mstripr.m - microstrip synthesis with refinement (calculates w/h from Z)
%
% Usage: [u,N] = mstripr(er,Z0,per)
%        [u,N] = mstripr(er,Z0)     (equivalent to per=0.2)
%
% er  = relative permittivity of substrate
% Z0  = desired characteristic impedance
% per = percent accuracy for Z0 and u, typically, 0.1<per<0.2
%
% u = width-to-height ratio = w/h
% N = number of refinement iterations
%
% uses mstrips and mstripa

% S. J. Orfanidis - 2000 - www.ece.rutgers.edu/~orfanidi/ewa

function [u,N] = mstripr(er,Z0,per)

if nargin==0, help mstripr; return; end
if nargin==2, per=0.2; end

Nmax = 3000;
per = per/100;

u = mstrips(er,Z0);                 % initial estimate of u 
[eff,Z] = mstripa(er,u);            % corresponding impedance

N = 0;

while 100*abs(Z-Z0)/Z0 > per,       
    if Z<=Z0,                       % Z is a decreasing function of u
        u = (1-per)*u;              % corrected u
    else
        u = (1+per)*u;
    end
    [eff,Z] = mstripa(er,u);        % corrected Z
    N = N+1;
    if N>Nmax, 
        u = mstrips(er,Z0);         % convergence failed, use initial value
        break;
    end
end


⌨️ 快捷键说明

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