Help with stem discrete signal plot

2 vues (au cours des 30 derniers jours)
Christopher Carey
Christopher Carey le 4 Déc 2017
Hey I want to dis play my signal which has values from n=[0,101] only from n=[0,50] but when i try it tells me x must be the same length as y here is my code.
clc; close all;
z = conv(x,h);
figure(2)
stem(0:1:51, y, 'r -');
hold on
stem(0:1:101, z, 'bo ')
xlabel('n');
ylabel('z[n]');
title('z[n] vs y[n]');
legend('y[n]','z[n]')

Réponses (1)

Elizabeth Reese
Elizabeth Reese le 6 Déc 2017
If y has values from n=[0,101], then in order for the two inputs of stem to be the same length, you can say
stem(0:50, y(1:51), 'r-')
This includes the first 51 values of y that are for n=[0,50].

Catégories

En savoir plus sur Stem Plots 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!

Translated by