Under, perfect, and over sampling a function and zero-order hold interpolation

조회 수: 27 (최근 30일)
the signal is x(t) = sin(200*pi*t) and i need to generate samples for under, perfect and over sampling
After that i need to use zero-order hold interpolation to generate 1000 samples
Mainly do not understand how to determine how the frequency varies between the sampling, as of right now im just throwing random frequencies in there and just seeing what looks right. Then in regard to the zero-order hold interpolation I have never used this before and do understand what i need to type into the code.
this is the code that i have for the sampling currently
Under:
f = 100;
p = pi;
t = 0:1/f:1;
x = sin(200*p*t);
figure(1);
stem(t,x);
Perfect:
f2 = 201;
t = 0:1/f2:1;
x = sin(200*p*t);
figure(2);
stem(t,x);
Over:
f3 = 300;
t = 0:1/f3:1;
x = sin(200*p*t);
figure(3);
stem(t,x);

채택된 답변

Swetha Polemoni
Swetha Polemoni 2021년 7월 2일
편집: Swetha Polemoni 2021년 7월 2일
Hi,
For a signal sin(2*pi*fm*t) , fm is its frequency. To sample this signal replace t = N*Ts. where N is an integer and Ts is sample period. fs = 1/Ts is sampling frequency.
For perfect sampling fs = 2*fm . This implies Ts = 1/2*fm
For under sampling fs < 2*fm . This implies Ts > 1/2*fm
For over sampling fs > 2*fm . This implies Ts < 1/2*fm
N = 1000 % number of samples
n = 0 : Ts :N*Ts % choose Ts based on equation and inequations for each sampling
x = sin(2*pi*fm*n);
In this documentation setinterpmethod you can find an example to use zero order hold interpolation.

추가 답변 (0개)

카테고리

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

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by