generating impulse

hi,
how can I generate an impulse with sampling frequency fs,which has an amplitude = 9 at the sample number fs = K.
thank u very much in advance

답변 (1개)

Wayne King
Wayne King 2011년 11월 30일

0 개 추천

Just create a vector of zeros the length you need and then place a 1 at the correct index in the vector.
x = zeros(1e3,1);
x(500) = 1;

댓글 수: 3

John
John 2011년 11월 30일
Thanks
Your example seems to not work for non integer values (0.02)...
It's not exactly what I'm looking for.
I need an impulse which could be used in further processing
Wayne King
Wayne King 2011년 11월 30일
you cannot index a vector at a noninteger value. However, the indices of the vector can correspond to n*DT where DT is the sampling interval. If you view x as sampled at 0.01 seconds, then x(2) is the value at 0.02
So whatever sampling interval you want to use in your application, just put the 1 at the index of the vector that corresponds to that sampling instant.
Wayne King
Wayne King 2011년 11월 30일
just to be clear, x(3) would be the value at 0.02 (given a 0.01 sampling interval) if you take the first time to be t=0

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

카테고리

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

질문:

2011년 11월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by