Anda di halaman 1dari 1

%Difference equation in MATLAB clc; n=1:1:100; b=input('Enter the coefficients of x[n]='); a=input('Enter the coefficients of y[n]='); yi=input('Enter initial

conditions='); xn=input('Enter the excitation signal='); zf=filtic(b,a,yi); ytotal=filter(b,a,xn,zf); yforced=filter(b,a,xn); ynatural=ytotal-yforced; subplot(4,1,1); stem(xn); xlabel('Time'); ylabel('Amplitude'); title('Excitation signal'); subplot(4,1,2); stem(ynatural); xlabel('Time'); ylabel('Amplitude'); title('Natural response'); subplot(4,1,3); stem(yforced); xlabel('Time'); ylabel('Amplitude'); title('Forced response'); subplot(4,1,4); stem(ytotal); xlabel('Time'); ylabel('Amplitude'); title('Total response');

Anda mungkin juga menyukai