In: Computer Science
Question
Solve It Using MATLAB.
Perform the experiment by changing the sampling frequency of the DAC block, Keep the parameters of sine wave block constant (set samples per period = 96 and sample period = 96/1000) and observe that increasing the sampling frequency is improving the waveform structure.
MATLAB PROGRAM
clc;
clear all;
close all;
U=10; % range signal from 0 to 10
n=3; % number of bits
q=U/(2^n-1); % quantization interval
t=0:0.096:10; % your time vector
y=abs(10*sin(t)); % your signal
% -------convert to a digital signal
yd-----------
a=fix(y/q);
yd=dec2bin(a,n);
% ------you can calculate the signal yq ----------
yq=a*q;
%-------------------------------------------------
plot(t,y,'r')
hold on
grid on
plot(t,yq,'g')
hold off
grid on
xlabel('Time');
ylabel('Amplitude');
title('Sampling frequency 96/1000')
MATLAB PROGRAM
clc;
clear all;
close all;
%-------------------------------------------------
%Doubling the sampling frequency
%-------------------------------------------------
clc;
clear all;
close all;
U=10; % range signal from 0 to 10
n=3; % number of bits
q=U/(2^n-1); % quantization interval
t=0:0.048:10; % your time vector
y=abs(10*sin(t)); % your signal
% -------convert to a digital signal
yd-----------
a=fix(y/q);
yd=dec2bin(a,n);
% ------you can calculate the signal yq ----------
yq=a*q;
%-------------------------------------------------
plot(t,y,'r')
hold on
plot(t,yq,'g')
hold off