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

📄 sp2sd.asv

📁 spread spectrum communication will be helpful to you!
💻 ASV
字号:
% To use S paramters in Simulink, one must convert the frequency domain
% data into a model that is expressed as differential equations. 
% The differential equations are expressed as Laplace Transforms  typically
% using the variable "s" (as in s domain) which can get confusing since we are also using
% the variable S to represent Scattering Parameters. 
% 
% To get to the s-domain the invfreqs function will be used. Transistors
% have rather low order models, so this simple function works reasonably
% well. 

 
clc
clear
ITER = 40;    % set some stopping parameters for invfreqs
TOL  = 0.01;

warning('off') % makes us feel better ... :-) 
[sinp,f] = s_extract('mrf904_10_10a.rfa',10,500,10);   % load the S parameter data 
% cycle through s11, s12, s21, s22
  for m=1:2
     for n=1:2
      % m = 1;
      % n = 1;
      h = sinp(m,n).s;
      w = 2*pi*f;       % note that f is in MHz ... 
      nb  = 4;
      na  = 4;
      run = 1;
      if m==n
         weight=[];
     else
         weight=1./(w);
     end
      [m,n]
      while run
         lastwarn('');
         [s904(m,n).num, s904(m,n).den] = invfreqs(h,w,nb,na,weight,ITER,TOL);     
         wmsg = lastwarn;
         if strcmp('',lastwarn) | (na==2) | (nb==2)
             run = 0;
         else
             nb=max(nb-1,2);
             na=max(na-1,2);
         end;
      end;
  
      % sys = minreal(tf(s904(m,n).num,s904(m,n).den), 0.00001*w(end))
      
      hf = figure('name',sprintf('s %i %i',m,n));
      plot(roots(s904(m,n).den)+j*eps,'x');      % need the eps to force it to plot real vs imag when there is no imag ! 
      hold on
      plot(roots(s904(m,n).num)+j*eps,'o');

     % hf = figure('name',sprintf('s %i %i',m,n));
     % hjw = polyval(s904(m,n).num,j*w)./polyval(s904(m,n).den,j*w);
     % plot(f, 20*log10(abs(hjw)));
      
      
      hf = figure('name',sprintf('s %i %i',m,n));
      freqs(s904(m,n).num,s904(m,n).den,w)
      hax=get(hf,'children');
      line('parent',hax(1),'xdata',w,'ydata',abs(h),'color',[1 0 0])
      line('parent',hax(2),'xdata',w,'ydata',(180/pi)*atan2(imag(h),real(h)),'color',[1 0 0])
   end;
 end;
 
 warning('on')
 save mrf904_smodel  s904

⌨️ 快捷键说明

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