plot discrete time function x(n)=y(n-2). it shows error (Attempted to access y(-1); index must be a positive integer or logical.)
Show older comments
clc;
clear all;
x=-5:1:5;
for n=1:11
if x(n)>=-3&&x(n)<=3
y(n-2)=2*x(n);
else
y(n-2)=0;
end
end
stem(x,y)
xlabel('n')% x-axis label
ylabel('x(n)')% y-axis label
Accepted Answer
More Answers (0)
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!