注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

Mr.Right

不顾一切的去想,于是我们有了梦想。脚踏实地的去做,于是梦想成了现实。

 
 
 

日志

 
 
关于我

人生一年又一年,只要每年都有所积累,有所成长,都有那么一次自己认为满意的花开时刻就好。即使一时不顺,也要敞开胸怀。生命的荣枯并不是简单的重复,一时的得失不是成败的尺度。花开不是荣耀,而是一个美丽的结束,花谢也不是耻辱,而是一个低调的开始。

网易考拉推荐

matlab 并联系统仿真  

2012-12-11 21:59:17|  分类: 学习 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
% Example:  Adding filter outputs and plotting 

% Given 3 second-order band-pass filters with center frequencies
% 300, 1000, 3000 Hz, bandwidths 200, 500, 600 Hz, and gains at
% resonance of 1, 1.5, 5, respectively.  Connect the filters so they
% have a common input and their outputs are fed into a summing amp
% with input resistors 10kOhm, 8kOhm, and 20 kOhm corresponding respectively
% to the outputs of the 3 band-pass filters.  The feedback resistor is 80 kOhm.
% Create the Bode plot of the resulting transfer function.

%  This script will plot the sum of 3 band-pass filters.
%  The range of interest will correspond to the center frequencies,
%  so plot from about a decade before 300 to a decade after 3000
%  (let's say 10 - 10,000 Hz).  This script will also call the function
%  TFEVAL to evaluate the TF points.
%

f = logspace(1, 4, 256);      %  Create Frequency Axis
%  Compute Individual Transfer Functions
h1 =  tfeval([0, 1*(200*2*pi), 0], [1, 200*2*pi, (2*pi*300)^2], f);
h2 =  tfeval([0, 1.5*(500*2*pi), 0], [1 500*2*pi, (2*pi*1000)^2],f);
h3 =  tfeval([0, 5*(600*2*pi), 0], [1, 600*2*pi, (2*pi*3000)^2], f);
%   Sum Transfer Functions Together
ht = -(80/10)*h1 - (80/8)*h2 - (80/20)*h3;

% Plot Magnitudes
figure(1)
semilogx(f, 20*log10(abs(ht)), '.k')    %  Plot the sum
xlabel('Frequency (Hz)')
ylabel('dB')
title('Resultant TF Magnitude')
grid

%  Just for fun, overlay the TF plots of the individual filters
hold     %  Hold current plot so others can be plotted on top
semilogx(f, 20*log10(abs(h1)), '-b');
semilogx(f, 20*log10(abs(h2)), ':b');
semilogx(f, 20*log10(abs(h3)), '-.b');
hold off   %  Remove hold on plot  

%  Plot Phase
figure(2)
semilogx(f, phase(ht)*180/pi, '.k')    %  Plot the sum
xlabel('Frequency (Hz)')
ylabel('Degrees')
title('Resultant TF phase')
grid

%  Just for fun, overlay the TF plots of the individual filters
hold     %  Hold current plot so others can be plotted on top
semilogx(f, phase(h1)*180/pi, '-b');
semilogx(f, phase(h2)*180/pi, ':b');
semilogx(f, phase(h3)*180/pi, '-.b');
hold off   %  Remove hold on plot  



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function p = tfeval(ns, ds, f)
%   This function evaluates a transfer function for a given frequency(s)
%
%       p = tfeval(ns, ds, f)
%
%   where NS => the vector representing the numerator polynomial
%        DS => the vector representing the denominator polynomial
%        F  => vector of frequency values in Hz at which the TF is
%              to be evaluated
%        P  => vector of TF values corresponding to F.
%
%                ns(1)*s^N + ns(2)*s^(N-1) ...+ ns(N)*s^1 + ns(N+1)
%       H(s) = ---------------------------------------------------
%                ds(1)*s^M + ds(2)*s^(M-1) ...+ ds(M)*s^1 + ds(M+1)
%
%     Example:
%               for linear frequency evaluation
%               >> freq = [0:10:10000];   %  Frequency points
%               >> numc = [10  0];   %  Numerator coefficients
%               >> denc = [1 5000*2*pi];   %  Denominator coefficients 
%               >> tf = tfeval(numc, denc, freq);    % Compute complex TF points
%               >>  figure; plot(f,abs(p)); ylabel('Magnitude')   %  Plot magnitude
%               >>  figure; plot(f,angle(p)*180/pi); ylabel('Degrees')  % Plot Phase
%
%       Updated by Kevin D. Donohue  ( donohue@engr.uky.edu ) February 1, 2010

num_order = length(ns)-1;  %  Determine order of numerator
den_order = length(ds)-1;  %  Determine order of denominator
 
s = 2j*pi*f;   %  Create s vector for evaluating TF
 
%  Loop to sum up every term in numerator 
sumn = zeros(size(s));  % Initialize accumulation variable
for k=1:num_order+1
    sumn = sumn + ns(k)*s.^(num_order-k+1);
end
 
%  Loop to sum up every term in numerator 
sumd = zeros(size(s));  % Initialize accumulation variable
for k=1:den_order+1
    sumd = sumd + ds(k)*s.^(den_order-k+1);
end 
p = sumn ./ sumd;   %  Divide numerator and denominator points


  评论这张
 
阅读(610)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2016