Discussion:   - Explain the results obtained.   - Discuss Values of SNR at different (2,4 and 16 bits per sample)

Introductory Circuit Analysis (13th Edition)
13th Edition
ISBN:9780133923605
Author:Robert L. Boylestad
Publisher:Robert L. Boylestad
Chapter1: Introduction
Section: Chapter Questions
Problem 1P: Visit your local library (at school or home) and describe the extent to which it provides literature...
icon
Related questions
Question

After pressing the RUN button in the Matlab program

 

Entered The BITS value (once 2 and again 4)

 

The results appeared as position in the second picture

 

Discussion:

 

- Explain the results obtained.

 

- Discuss Values of SNR at different (2,4 and 16 bits per sample)

1. Make a folder at desktop and name it "DSP_Lab and set it as your current directory within
MATLAB.
2. Open M-file editor and save it under "Exp_02_Quantization" and then write the following
code:
Code:
clc;clear; close all;
disp('Generate 0.02-second sine wave of 100 Hz and Vp=5');
Xmax=1;
Xmin=-1;
|fs=8000; % Sampling rate
Ts=1/fs; % Sampling interval
nTs=0:Ts:1; % Duration of 0.02 second
sig = sin(2*pi*1*nTs); % Generate sinusoids
bits = input('input number of bits =');
lg =length(sig); % Length of signal vector
L=2^bits;
| delta=(Xmax-Xmin)/L;
for x=1:lg
I(x)=round((sig(x)-Xmin)/delta);
if (1(x)==L)
|(x)=1(x)-1;
end
if 1(x)<0
I(x)=0;
end
qsig(x)=Xmin+I(x)*delta;
end
qerr=qsig-sig;
stairs(nTs,qsig, 'b'); hold % Plot signal in staircase style
plot(nTs, sig, 'r'); grid; % Plot signal
xlim ([0 1]);
xlabel('Time (sec.)'); ylabel('Quantized x(n)')
Transcribed Image Text:1. Make a folder at desktop and name it "DSP_Lab and set it as your current directory within MATLAB. 2. Open M-file editor and save it under "Exp_02_Quantization" and then write the following code: Code: clc;clear; close all; disp('Generate 0.02-second sine wave of 100 Hz and Vp=5'); Xmax=1; Xmin=-1; |fs=8000; % Sampling rate Ts=1/fs; % Sampling interval nTs=0:Ts:1; % Duration of 0.02 second sig = sin(2*pi*1*nTs); % Generate sinusoids bits = input('input number of bits ='); lg =length(sig); % Length of signal vector L=2^bits; | delta=(Xmax-Xmin)/L; for x=1:lg I(x)=round((sig(x)-Xmin)/delta); if (1(x)==L) |(x)=1(x)-1; end if 1(x)<0 I(x)=0; end qsig(x)=Xmin+I(x)*delta; end qerr=qsig-sig; stairs(nTs,qsig, 'b'); hold % Plot signal in staircase style plot(nTs, sig, 'r'); grid; % Plot signal xlim ([0 1]); xlabel('Time (sec.)'); ylabel('Quantized x(n)')
Results:
2-bits
Quantized x(n)
Quantized x(n)
4-bits: 5
5
4
3
2
-
-2
-3
-4
-5
0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02
Time (sec.)
4
3
2
M n
17
-2
-3
-4
-5
0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02
Time (sec.)
Transcribed Image Text:Results: 2-bits Quantized x(n) Quantized x(n) 4-bits: 5 5 4 3 2 - -2 -3 -4 -5 0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02 Time (sec.) 4 3 2 M n 17 -2 -3 -4 -5 0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02 Time (sec.)
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
MOS logic circuit
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, electrical-engineering and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Introductory Circuit Analysis (13th Edition)
Introductory Circuit Analysis (13th Edition)
Electrical Engineering
ISBN:
9780133923605
Author:
Robert L. Boylestad
Publisher:
PEARSON
Delmar's Standard Textbook Of Electricity
Delmar's Standard Textbook Of Electricity
Electrical Engineering
ISBN:
9781337900348
Author:
Stephen L. Herman
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Electrical Engineering
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education
Fundamentals of Electric Circuits
Fundamentals of Electric Circuits
Electrical Engineering
ISBN:
9780078028229
Author:
Charles K Alexander, Matthew Sadiku
Publisher:
McGraw-Hill Education
Electric Circuits. (11th Edition)
Electric Circuits. (11th Edition)
Electrical Engineering
ISBN:
9780134746968
Author:
James W. Nilsson, Susan Riedel
Publisher:
PEARSON
Engineering Electromagnetics
Engineering Electromagnetics
Electrical Engineering
ISBN:
9780078028151
Author:
Hayt, William H. (william Hart), Jr, BUCK, John A.
Publisher:
Mcgraw-hill Education,