📄 iztlong.m
字号:
function [y,n] = iztlong(b,a,N,ty)
% IZTLONG Inverse z-transform sequence by long division.
%
% [Y,n] = IZTLONG(N,D,K,TY) Simulates IZT by long division.
% N,D = Num and Den of H(z) = of N(z)/D(z) in descending order
% TY='r' for rightsided or 'l' for leftsided (noncausal) [Default: 'r'].
% K = number of IZT values required
% Y returns the IZT sequence
% n returns the index of the values in Y
%
% IZTLONG (with no input arguments) invokes the following example:
%
% % Find the first 5 terms of the causal IZT of H(z) = (z-4)/(z*z-z+1)
% >>[y5,n5] = iztlong([1 -4],[1 -1 1],5)
% ADSP Toolbox: Version 2.0
% For use with "Analog and Digital Signal Processing", 2nd Ed.
% Published by PWS Publishing Co.
%
% Ashok Ambardar, EE Dept. MTU, Houghton, MI 49931, USA
% http://www.ee.mtu/faculty/akambard.html
% e-mail: akambard@mtu.edu
% Copyright (c) 1998
if nargin==0,help iztlong,disp('Strike a key to see results of the example')
pause,[y5,n5]=iztlong([1 -4],[1 -1 1],5),return,end
if nargin<4,ty='r';end,ty=ty(1);
while b(1)==0,b(1)=[];end,
while a(1)==0;a(1)=[];end,
ind=length(a)-length(b);
if ty~='r',
b=fliplr(b);a=fliplr(a);ia=0;ib=0;
while b(1)==0,b(1)=[];ib=ib+1;end,
while a(1)==0;a(1)=[];ia=ia+1;end,
ind=ia-ib;
end
y=filter(b,a,[1 zeros(1,N-1)]);
if ty=='r',n=(0:N-1)+ind;else,n=(0:-1:-(N-1))+ind;end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -