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')
  1 件のコメント
Miguel Amor Rodriguez Avelino
Miguel Amor Rodriguez Avelino 2022 年 4 月 29 日
THANKS

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultirate Signal Processing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by