Which is my mistake?

1 visualización (últimos 30 días)
Miguel Amor Rodriguez Avelino
Miguel Amor Rodriguez Avelino el 28 de Abr. de 2022
% 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

Respuesta aceptada

Chunru
Chunru el 29 de Abr. de 2022
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')

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by