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

📄 calc_transfer.html

📁 均衡器的参数设置,设置不同的参数
💻 HTML
字号:
<!DOCTYPE html  PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"><html xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">   <head>      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">         <!--This HTML is auto-generated from an M-file.To make changes, update the M-file and republish this document.      -->      <title>calc_transfer.m</title>      <meta name="generator" content="MATLAB 7.4">      <meta name="date" content="2008-05-07">      <meta name="m-file" content="calc_transfer"><style>body {  background-color: white;  margin:10px;}h1 {  color: #990000;   font-size: x-large;}h2 {  color: #990000;  font-size: medium;}/* Make the text shrink to fit narrow windows, but not stretch too far in wide windows. */ p,h1,h2,div.content div {  max-width: 600px;  /* Hack for IE6 */  width: auto !important; width: 600px;}pre.codeinput {  background: #EEEEEE;  padding: 10px;}@media print {  pre.codeinput {word-wrap:break-word; width:100%;}} span.keyword {color: #0000FF}span.comment {color: #228B22}span.string {color: #A020F0}span.untermstring {color: #B20000}span.syscmd {color: #B28C00}pre.codeoutput {  color: #666666;  padding: 10px;}pre.error {  color: red;}p.footer {  text-align: right;  font-size: xx-small;  font-weight: lighter;  font-style: italic;  color: gray;}  </style></head>   <body>      <div class="content">         <h1>calc_transfer.m</h1>         <introduction></introduction>         <h2>Contents</h2>         <div>            <ul>               <li><a href="#2">Vector Initialization</a></li>               <li><a href="#4">Transfer Function Calculations</a></li>               <li><a href="#6">Returned Values</a></li>            </ul>         </div>         <p>This function calculates the transfer function of the combined equalizer. the function returns a vector containing the phase            of the equalizer, and another vector containing the magnitude of the equalizer.  <tt>w0_vector</tt> provides a vector to plot the phase or magnitude against.  The frequencies in this vector are logarithmically spaced.         </p><pre class="codeinput"><span class="keyword">function</span> [filter_mag,filter_phase,w0_vector] = calc_transfer(w0,q0,hbp,n)</pre><h2>Vector Initialization<a name="2"></a></h2>         <p>The w0_vector (the x axis in a bode plot) is created based on the maximum and minimum center frequencies of the equalizer.             Also, the vector which will hold the complex transfer function of the equalizer is intialized         </p><pre class="codeinput">        w0_vector = logspace(log10(w0(1)*.01),log10(w0(n)*100),1000);        filter_vector = zeros(1,1000);</pre><h2>Transfer Function Calculations<a name="4"></a></h2>         <p>For each filter in the equalizer, the parameters of the filter are extracted from the input, and the second order transfer            function is calculated.  These individual transfer functions are added, since each filter would be connected in parallel.         </p><pre class="codeinput">        <span class="keyword">for</span> filter_n = 1:n            <span class="comment">%calculate the filter parameters...</span>            w0f = w0(filter_n);            hbpf = hbp(filter_n);            q0f = q0(filter_n);            <span class="comment">%calculate the filter function...</span>            current_filter_func = (-hbpf * (w0f/q0f)*j.*w0_vector)./((j.*w0_vector).^2 + ((w0f/q0f)*j.*w0_vector) + (w0f^2));            <span class="comment">%adding the filters in parallel...</span>            filter_vector = filter_vector + current_filter_func;        <span class="keyword">end</span></pre><h2>Returned Values<a name="6"></a></h2>         <p>the magnitude and phase of the combined equalizer are returned.  the x axis vector has already been created.</p><pre class="codeinput">        <span class="comment">%returns</span>        filter_mag = abs(filter_vector);        filter_phase = angle(filter_vector);</pre><pre class="codeinput"><span class="keyword">end</span></pre><p class="footer"><br>            Published with MATLAB&reg; 7.4<br></p>      </div>      <!--##### SOURCE BEGIN #####%% calc_transfer.m
%%
% This function calculates the transfer function of the combined equalizer.
% the function returns a vector containing the phase of the equalizer, and
% another vector containing the magnitude of the equalizer.  |w0_vector| 
% provides a vector to plot the phase or magnitude against.  The
% frequencies in this vector are logarithmically spaced.


function [filter_mag,filter_phase,w0_vector] = calc_transfer(w0,q0,hbp,n)
%%
%% Vector Initialization
%%
% The w0_vector (the x axis in a bode plot) is created based on the
% maximum and minimum center frequencies of the equalizer.  Also, the
% vector which will hold the complex transfer function of the equalizer is
% intialized

       
        w0_vector = logspace(log10(w0(1)*.01),log10(w0(n)*100),1000);
        filter_vector = zeros(1,1000);
%%
        
%% Transfer Function Calculations
%%
% For each filter in the equalizer, the parameters of the filter are
% extracted from the input, and the second order transfer function is calculated.  These
% individual transfer functions are added, since each filter would be
% connected in parallel.

        for filter_n = 1:n
            
            
            %calculate the filter parameters...
            w0f = w0(filter_n);
            hbpf = hbp(filter_n);
            q0f = q0(filter_n);
            
            %calculate the filter function...
            current_filter_func = (-hbpf * (w0f/q0f)*j.*w0_vector)./((j.*w0_vector).^2 + ((w0f/q0f)*j.*w0_vector) + (w0f^2));
            
            %adding the filters in parallel...
            filter_vector = filter_vector + current_filter_func;
        end
%%
        
%% Returned Values
%%
% the magnitude and phase of the combined equalizer are returned.  the x
% axis vector has already been created.

        %returns
        filter_mag = abs(filter_vector);
        filter_phase = angle(filter_vector);
%%
        
end
        ##### SOURCE END #####-->   </body></html>

⌨️ 快捷键说明

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