数字信号处理、6.43MATLAB验证:

6.43MATLAB验证:
[r,p,k]=residuez([0 1 1.7],conv([1 0.3],[1 -0.5]))

r =

5.5000
5.8333

p =

0.5000

-0.3000

k =

-11.3333

M6.1

factorize.m:
function Factors = factorize(polyn)
     format long; Factors = [];
     % Use threshold of 1e-8 instead of 0 to account for
     % precision effects
     THRESH = 1e-8;
     %
     proots = roots(polyn); % get the zeroes of the polynomial
     len = length(proots); % get the number of zeroes
     %
     while(len > 1)
        if(abs(imag(proots(1))) < THRESH) % if the zero is a real zero
            fac = [1 -real(proots(1))];
            % construct the factor with proots(1) as zero
            Factors = [Factors;[fac 0]];
        else  % if the zero has imaginary part get all zeroes whose
            %  imag part is -ve of imaginary part of proots(1)
            negimag = imag(proots)+imag(proots(1));
            % get all zeroes which have same real part as proot(1)
            samereal = real(proots)-real(proots(1));
            %find the complex conjugate zero
            index = find(abs(negimag) <THRESH & abs(samereal)<THRESH);
                if(index) % if the complex conjugate exists
                    fac = [1 -2*real(proots(1)) abs(proots(1))^2];
                    %form 2nd order factor
                    Factors = [Factors;fac];
                else % if the complex conjugate does not exist
                    fac = [1 -proots(1)];
                    Factors = [Factors;[fac 0]];
                end
        end
        polyn = deconv(polyn,fac);
        %deconvolve the 1st/2nd order factor from polyn
        proots = roots(polyn); %determine the new zeros
        len = length(polyn); %determine the number of zeros
     end

脚本:

num = input('Type in the numerator coefficients = ');
den = input('Type in the denominator coefficients = ');
K = num(1)/den(1);
Numfactors = factorize(num)
Denfactors = factorize(den)
disp('Numerator factors');disp(Numfactors);
disp('Denominator factors');disp(Denfactors);
disp('Gain constant');disp(K);
zplane(num,den) 

输入:
Type in the numerator coefficients = [3 -2.4 15.36 3.84 9]
Type in the denominator coefficients = [5 -8.5 17.6 4.7 -6]

输出:
在这里插入图片描述
输入:
Type in the numerator coefficients = [2 0.2 6.4 4.6 2.4]
Type in the denominator coefficients = [5 1 6.6 0.42 24]
输出:在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

位沁

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值