-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsampling.m
More file actions
40 lines (35 loc) · 747 Bytes
/
sampling.m
File metadata and controls
40 lines (35 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
%Sampling Theorem
clear all;
close all;
clc;
f=input("Enter frequency = ");
%T=1/f;
fs1=input("Enter the sampling frequency = ");
fs2=input("Enter the sampling frequency = ");
fs3=input("Enter the sampling frequency = ");
t=0:0.1:100;
t1=0:1:99;
x=sin(2*3.14*f*t);
subplot(4,1,1);
plot(t,x);
xlabel("Time");
ylabel("Amplitude");
title("Continuous sine wave");
y=sin(2*3.14*f*t1/fs1);
subplot(4,1,2);
stem(t1,y);
xlabel("Time");
ylabel("Amplitude");
title("Sampled at 50");
y=sin(2*3.14*f*t1/fs2);
subplot(4,1,3);
stem(t1,y);
xlabel("Time");
ylabel("Amplitude");
title("Sampled at 500");
y=sin(2*3.14*f*t1/fs3);
subplot(4,1,4);
stem(t1,y);
xlabel("Time");
ylabel("Amplitude");
title("Sampled at 5000");