Which is my mistake?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Miguel Amor Rodriguez Avelino
le 28 Avr 2022
Commenté : Miguel Amor Rodriguez Avelino
le 29 Avr 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
0 commentaires
Réponse acceptée
Chunru
le 29 Avr 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')
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Subplots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!