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

📄 buildcircuit_selectcircuit.m

📁 Talking about adaptive filter digital
💻 M
字号:
function strCircuit = BuildCircuit_SelectCircuit(strCircuit, curStage, schTitle)
% BuildCircuit_SelectCircuit is a subfile of the AnalogFilter GUI collection
%
% BuildCircuit_SelectCircuit recalculates strCircuit biquad with a new given circuit type.
% Because the new circuit may require a different/new/deleted final circuit gain stage,
% the entire strCircuit structure must be passed to it.
%
% James C. Squire, Assistant Professor, Virginia Military Institute
% ver 1.0


sPurpose = strCircuit.sPurpose; % LP, HP, or Notch
k = abs(strCircuit.vStage(curStage).k);
switch sPurpose
    case 'LP'
        switch schTitle
            case 'Sallen-Key'
                % kDC = k / pp* for LP or k otherwise - important because SK uses a different 
                % configuration for kDC <=1 and >1 
                kDC = abs(k/(abs(strCircuit.vStage(curStage).p(1))^2));
                if abs(kDC-1) < 0.00001 % make it exact
                    kDC = 1;
                end
                if kDC <= 1
                    schName = 'SK_LP_kLE1';
                else
                    schName = 'SK_LP_kGT1';
                end
            case 'Multiple Feedback'
                schName = 'MFB_LP';
            case 'Ackerberg-Mossberg (+)'
                schName = 'AM_LP_N';
            case 'Ackerberg-Mossberg (-)'
                schName = 'AM_LP_I';
            otherwise, error(['Unrecognized schTitle ' schTitle])
        end
    case 'HP'
        switch schTitle
            case 'Sallen-Key'
                if k<=1
                    schName = 'SK_HP_kLE1';
                else
                    schName = 'SK_HP_kGT1';
                end
            case 'Ackerberg-Mossberg'
                schName = 'AM_HP';
            otherwise, error(['Unrecognized schTitle ' schTitle])
        end
    case 'Notch'
        switch schTitle
            case 'Multiple Feedback'
                if  isempty(strCircuit.vStage(curStage).z) 
                    error('Not a Notch if no zeros present')
                end
                z=strCircuit.vStage(curStage).z(1);
                p=strCircuit.vStage(curStage).p(1);
                if abs(z) > abs(p) %LP
                    schName = 'MFB_Z_LP';
                else %HP
                    schName = 'MFB_Z_HP';
                end
            case 'Ackerberg-Mossberg'
                schName = 'AM_Z';
            otherwise, error(['Unrecognized schTitle ' schTitle])
        end
    otherwise error(['Unrecognized sPurpose ' sPurpose] )
end

% save the new schName, schTitle in strCircuit
strCircuit.vStage(curStage).schName = schName;
strCircuit.vStage(curStage).schTitle = schTitle;

% update the components in this stage
nCTol = strCircuit.nCTol;
nRTol = strCircuit.nRTol;
strCircuit.vStage(curStage) = BuildCircuit_UpdateComponents(strCircuit.vStage(curStage),nRTol,nCTol);
strCircuit = BuildCircuit_LastStage(strCircuit); % possible gain stage has changed

⌨️ 快捷键说明

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