Codes For The Graph of The Given Question
Codes For The Graph of The Given Question
Codes For The Graph of The Given Question
3
CODES FOR THE GRAPH OF THE GIVEN QUESTION
freq = 2000; % frequency
mag1 = 3; % magnitude-1
mag2=0.5; % magnitude-2
num_points = 200; % How many points to use
% 200 makes it look smooth
step = 2/(freq*num_points); % get a nice step size
t = 0:step:2*(1/freq); % "time"
% x and y are simulated analog functions
x = mag1*sin(2*pi*freq*t ) + mag2*cos(1*pi*freq*t );
% Plot the "analog" signals
plot(t, x, 'r.-');
grid on
my_title = sprintf('Simulated analog signals, x=dots ');
title(my_title); xlabel(' time '); ylabel('Amplitude');
Samples(
ms)
Code
Number
Binary
Codes
Gray
Codes
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
14
11
12
10
111
0
100
1
101
1
111
0
010
0
011
0
000
1
000
1
011
1
010
0
110
0
101
0
101
0
111
1
010
1
011
1
001
1
001
0
1000
1100
ii)
iii)
iv)
v)