Discrete Time Plotting x[n]+x[-n] Using Stem

Hello, I have a signal which is u[n]-u[n-1], where n is 0<n<5. I need to plot the graph of x[n]+x[-n]. I can plot them like x[n] and x[-n] but I can not plot their summation.
!! I MEAN IT DOES NOT SHOW ME THE RESULTS BEFORE 0, IT JUST SHOWS ME THE VALUES AFTER 0 !!
How can I do it? Thanks for your sugggestions.

댓글 수: 2

Did you try using hold on?
stem(x[n]); hold on;
stem(x[-n]);
stem(x[n-5]);
enrique128
enrique128 2020년 11월 12일
it does not give the exact result. I need just spesific values and it cannot meet the requirements by holding on the graph.

댓글을 달려면 로그인하십시오.

답변 (1개)

matt
matt 2022년 12월 1일
편집: matt 2022년 12월 1일
The question is unclear in definiton of signal. assuming x[n] = u[n]-u[n-1], u[n] is heavyside function, function to plot is y[n] = x[n]-x[-n]
nn = (eps:.1:5-eps); %eps starts interval just right of zero and ends interval just right of interval
syms n
u = heaviside(n); % define u
x = subs(u,n,nn) - subs(u,n,nn-1);
x2 = subs(u,n,-nn) - subs(u,n,-nn-1);
stem(nn,x+x2) % plot y

카테고리

도움말 센터File Exchange에서 Discrete Data Plots에 대해 자세히 알아보기

질문:

2020년 11월 12일

편집:

2022년 12월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by