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

조회 수: 33(최근 30일)
Nathan A Scott 2021년 6월 25일
편집: Swetha Polemoni 2021년 7월 2일
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 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.

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

### 범주

Find more on Multirate Signal Processing in Help Center and File Exchange

R2020a

### Community Treasure Hunt

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

Start Hunting!

Translated by