世纪电源网社区logo
社区
Datasheet
标题
返回顶部
已解决

电路模型转化为MATLAB代码(求大神)看完立马崩溃

[复制链接]
查看: 805 |回复: 2
1
Cascaded
  • 积分:844
  • |
  • 主题:20
  • |
  • 帖子:126
积分:844
LV6
高级工程师
  • 2017-4-20 21:28:08
10问答币
就是电路模型转化为MATLAB代码的运算,代码已经有了。就是不知道怎么来的。看了好长时间不理解。
                        
电路是这样一个简单的电路,但是代码不知道怎么回事?代码如下:
example5.m

c=590e-6;                           % input capacitance
r=0.127;                            % input capacitance series resistance
vmax=420.0;                         % maximum input voltage
vmin=400.0;                         % minimum input voltage
nv=5;                               % number of voltages to use
pmin=0.0;                           % minimum power
pmax=5000;                          % maximum power
np=10;                              % number of powers to use
[PCM2_L] = cpld(c,r,vmin,vmax,nv,pmin,pmax,np,s,NS,NI);
function = svec1(freqmin,freqmax,N)  
s=(-1j*2*pi*logspace(log10(freqmin),log10(freqmax),N))';

其中所调用的函数如下:
函数一:
function = svec1(freqmin,freqmax,N)
Inputs:
% freqmin = minimum frequency, Hz
% freqmax = maximum frequency, Hz
%     N       = number of points
% Outputs:
% s = vector of s-plane values

s=(-1j*2*pi*logspace(log10(freqmin),log10(freqmax),N))';

函数二:

function [varargout] = cpld(c,r,vmin,vmax,nv,pmin,pmax,np,s,NS,NI)   

% NS   = number of sides used to represent the constraint boundary
% NI   = number of interpolating points used to represent the constraint boundary   



Outputs (2nd form of Call):

% CA,CB= Concatentated A,B,C, and D matrices with an input of the dc
% CC,CD  current into load and output vector of the dc voltage at load  terminals


if (nargout~=1)&&(nargout~=4)
   error('Invalid number of output arguments');   
end

% voltage variation
v0=linspace(vmin,vmax,nv);

% constant power load
p=linspace(pmin,pmax,np);

% dimension the A,B,C, D matrices appropriately
CA(1,np*nv)=0.0;
CB(1,np*nv)=0.0;
CC(1,np*nv)=0.0;
CD(1,np*nv)=0.0;

% compute the state space matrices
for k1=1:np,
   for k2=1:nv,
      index=k2+nv*(k1-1);
      y=-p(k1)/(v0(k2)^2);
      dinv=1.0/(1.0+r*y);
      CA(index)=-y*dinv/c;
      CB(index)=dinv/c;
      CC(index)=dinv;
      CD(index)=r*dinv;
   end
end

if nargout==4

   % pass out the concatentated state space description
   varargout(1)={CA};
   varargout(2)={CB};
   varargout(3)={CC};
   varargout(4)={CD};

else

   % pass out the generalized source impedance
   varargout(1)={stspchar1(CA,CB,CC,CD,1,s,NS,NI)};

end




主要的就是CA、CB、CC、CD不知什么意思?还有就是那个NS、NI也不是太明白。(程序默认为二端口网略)




最佳答案

收藏收藏2
ThaisenRen
  • 积分:1047
  • |
  • 主题:45
  • |
  • 帖子:277
积分:1047
LV6
高级工程师
  • 2017-4-21 11:37:10
  • 倒数2
 
不会
Cascaded
  • 积分:844
  • |
  • 主题:20
  • |
  • 帖子:126
积分:844
LV6
高级工程师
最新回复
  • 2017-4-24 18:02:10
  • 倒数1
 
你这句回答可以
热门技术、经典电源设计资源推荐

世纪电源网总部

地 址:天津市南开区黄河道大通大厦8层

电 话:400-022-5587

传 真:(022)27690960

邮 编:300110

E-mail:21dy#21dianyuan.com(#换成@)

世纪电源网分部

广 东:(0755)82437996 /(138 2356 2357)

北 京:(010)69525295 /(15901552591)

上 海:(021)24200688 /(13585599008)

香 港:HK(852)92121212

China(86)15220029145

网站简介 | 网站帮助 | 意见反馈 | 联系我们 | 广告服务 | 法律声明 | 友情链接 | 清除Cookie | 小黑屋 | 不良信息举报 | 网站举报

Copyright 2008-2024 21dianyuan.com All Rights Reserved    备案许可证号为:津ICP备10002348号-2   津公网安备 12010402000296号