Which is my mistake?

조회 수: 2 (최근 30일)
Miguel Amor Rodriguez Avelino
Miguel Amor Rodriguez Avelino 2022년 4월 28일
% P0232: Use function ’filter’ to study the impulse response and
% step response of a system specified by LCCDE
close all; clc
N = 60;
n = 0:N-1;
b = [0.18 0.1 0.3 0.1 0.18];
a = [1 -1.15 1.5 -0.7 0.25];
d = delta(n(1), 0 , n(end));
u = unitstep(n(1),0,n(end));
y1 = filter(b,a,d);
y2 = filter(b,a,u);
% Plot:
subplot(2,1,1)
stem(n,y1,'fill')
axis([n(1)-1,n(end)+1,min(y1)-0.2,max(y1)+0.2])
xlabel('n')
title('Impulse Response');
subplot(2,1,2)
stem(n,y2,'fill')
axis([n(1)-1,n(end)+1,min(y2)-0.5,max(y2)+0.5])
xlabel('n')
title('Step Response')
v

채택된 답변

Chunru
Chunru 2022년 4월 29일
N = 60;
n = 0:N-1;
b = [0.18 0.1 0.3 0.1 0.18];
a = [1 -1.15 1.5 -0.7 0.25];
%d = delta(n(19n), 0 , n(end));
d = zeros(size(n)); d(1)=1;
%u = unitstep(n(1),0,n(end));
u = ones(size(n));
y1 = filter(b,a,d);
y2 = filter(b,a,u);
% Plot:
subplot(2,1,1)
stem(n,y1,'fill')
axis([n(1)-1,n(end)+1,min(y1)-0.2,max(y1)+0.2])
xlabel('n')
title('Impulse Response');
subplot(2,1,2)
stem(n,y2,'fill')
axis([n(1)-1,n(end)+1,min(y2)-0.5,max(y2)+0.5])
xlabel('n')
title('Step Response')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by