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

📄 calc_parameters.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_parameters.m</title>      <meta name="generator" content="MATLAB 7.4">      <meta name="date" content="2008-05-08">      <meta name="m-file" content="calc_parameters"><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_parameters.m</h1>         <introduction></introduction>         <h2>Contents</h2>         <div>            <ul>               <li><a href="#2">Center frequency selection</a></li>               <li><a href="#4">Quality and band pass gain vector creation</a></li>            </ul>         </div>         <p>This function takes the user input and makes it a bit more usable for the rest of the functions.  Given the lowest center            frequency, highest center frequency, a filter scalar or vector, a band pass gain scalar or vector, and the number of filters            in the equalizer, return a vector of angular frequencies, qualities, band pass gains, and a scalar representing the number            of filters.         </p><pre class="codeinput"><span class="keyword">function</span> [w0,q0,hbp,n] = calc_parameters(f01,f02,q0,hbp,n)</pre><h2>Center frequency selection<a name="2"></a></h2>         <p>We would like to have the center frequencies of the fitlers evenly spaced (logarithmically) in frequency.  The follwoing code            accomplishes this.         </p><pre class="codeinput">    <span class="comment">%for the specificed frequency range, choose the</span>    <span class="comment">%cetner frequencies of the filters.</span>    low_freq = log10(2*pi*f01);    high_freq = log10(2*pi*f02);    w0 = logspace(low_freq,high_freq,n);</pre><h2>Quality and band pass gain vector creation<a name="4"></a></h2>         <p>The user can enter either a scalar or a vector for the quality of each filter.  If a scalar is entered, the scalar will be            copied to a vector of length n, where n reprensents the number of fitlers in the equalizer         </p><pre class="codeinput">    <span class="comment">%if the user supplied a single value, extend the vector</span>    <span class="comment">%to n. each entry will be the specified value.</span>    <span class="keyword">if</span> (length(q0) &lt; n)        <span class="keyword">for</span> filter_n = 1:n            q0(filter_n) = q0(1);        <span class="keyword">end</span>    <span class="keyword">end</span>    <span class="comment">%same idea here</span>    <span class="keyword">if</span> (length(hbp) &lt; n)        <span class="keyword">for</span> filter_n = 1:n            hbp(filter_n) = hbp(1);        <span class="keyword">end</span>    <span class="keyword">end</span>    <span class="comment">%haha</span>    n = n;<span class="keyword">end</span></pre><p class="footer"><br>            Published with MATLAB&reg; 7.4<br></p>      </div>      <!--##### SOURCE BEGIN #####

%% calc_parameters.m
%%
% This function takes the user input and makes it a bit more usable for the
% rest of the functions.  Given the lowest center frequency, highest center
% frequency, a filter scalar or vector, a band pass gain scalar or vector,
% and the number of filters in the equalizer, return a vector of angular
% frequencies, qualities, band pass gains, and a scalar representing the
% number of filters.

function [w0,q0,hbp,n] = calc_parameters(f01,f02,q0,hbp,n)
%%
    
%% Center frequency selection
%%
% We would like to have the center frequencies of the fitlers evenly
% spaced (logarithmically) in frequency.  The follwoing code accomplishes
% this.


    %for the specificed frequency range, choose the 
    %cetner frequencies of the filters.
    low_freq = log10(2*pi*f01);                
    high_freq = log10(2*pi*f02);             
    w0 = logspace(low_freq,high_freq,n);
%%
    
%% Quality and band pass gain vector creation
%%
% The user can enter either a scalar or a vector for the quality of each
% filter.  If a scalar is entered, the scalar will be copied to a vector of
% length n, where n reprensents the number of fitlers in the equalizer

    
    %if the user supplied a single value, extend the vector
    %to n. each entry will be the specified value.
    if (length(q0) < n)
        for filter_n = 1:n
            q0(filter_n) = q0(1);
        end
    end
    
    %same idea here
    if (length(hbp) < n)
        for filter_n = 1:n
            hbp(filter_n) = hbp(1);
        end
    end
    
    %haha
    n = n;

end
%%
##### SOURCE END #####-->   </body></html>

⌨️ 快捷键说明

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