필터 지우기
필터 지우기

how to code a discrete signal

조회 수: 106 (최근 30일)
지우 김
지우 김 2021년 5월 5일
답변: KSSV 2021년 5월 5일
hi im new to matlab and just been doing some coding
but i was wondering if anyone could help me cause i really cant find how the code the delayed diescrete signal
so im trying to code the next signal
y[nT]=y[(n-1)T]+3x[nT]
and i tried coding it like
y = @(n,T) y(n-1,T)+3*x(n,T)
but i just cant plot the y[nT] using stem()
it just comes out as a blank so i thought there be an error in the code for the delayed part of y
could anybody help?
  댓글 수: 1
Dyuman Joshi
Dyuman Joshi 2021년 5월 5일
You need to initialise the sequence with some values. Looking at the documentation of stem() might help you understand better.

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

답변 (1개)

KSSV
KSSV 2021년 5월 5일
You need to have array x and initial value of y in hand first.
Example:
x = rand(100,1) ;
y0 = rand ;
n = length(x) ;
y = zeros(n,1) ;
y(1) = y0 ;
for i = 2:n
y(i)=y(i-1)+3*x(i) ;
end
stem(1:n,y)

카테고리

Help CenterFile Exchange에서 Stem Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by