-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathAliasing.m
More file actions
53 lines (35 loc) · 634 Bytes
/
Aliasing.m
File metadata and controls
53 lines (35 loc) · 634 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
41
42
43
44
45
46
47
48
49
50
51
52
clc;
close all;
t = 0:0.001:1;
f = 10;
Fs = 19;
xt = sin(2*pi*f*t);
hold on;
plot(t,xt);
grid on;
% Sampling
N = 0:1/Fs:1;
xn = sin(2*pi*f*N);
% Check Aliasing
if (Fs/2<f)
i = 1;
going = 1;
while(going)
alias = abs(f - Fs* i);
if(alias>= f*2)
i = i+1;
else
going = 0;
end;
end;
if(fs>f)
xalias = sin(2*pi*alias*t+pi);
else
xalias = sin(2*pi*alias);
end;
title(['Aliased Frequency : ' num2str(alias) 'Hz' ]);
plot(t,xalias,"r","LineWidth",2);
hold off;
else
title('No Aliasing');
end;