lab 2 signal analysis
docx
keyboard_arrow_up
School
University of North Texas *
*We aren’t endorsed by this school
Course
3311
Subject
English
Date
Dec 6, 2023
Type
docx
Pages
5
Uploaded by UltraGoldfish3847
BMEN 3311 Lab 2 S
ampling
& Quantization
Names: ID:
Question1. The figure below shows how blood pressure can be classified based on the diastolic and systolic pressures. Write a MATLAB script m-file to display a message indicating the classification based on the values of two variables representing the diastolic and systolic pressures. The two blood pressure values should be read in from the keyboard.
diastolic = input(
'enter diastolic pressure:'
);
systolic = input(
'Enter systolic pressure:'
);
if
(systolic < 90) && (diastolic<60)
disp(
'Low blood pressure'
);
elseif
(systolic<120) && (diastolic<80)
disp(
'Ideal blood pressure'
)
elseif
(systolic<140) && (diastolic<90)
disp(
'Pre- high blood pressure'
)
else
disp(
'High blood pressure'
)
end
Question 2. The following analog signal is sampled at 1.2kHz over an interval of 100 ms.
x
(
t
)
=
5.5sin
(
2
π
50
t
)
+
4.3cos
(
2
π
10
t
)
a.
Write a MATLAB script to create the digital signal using 10 bits and an operating voltage range from -10 V to 10 V. Plot the digital signal and ensure that plot is labeled accordingly. Have TA verify plot.
b.
1, Create a histogram of the quantization error. The x-axis is voltage and y-axis is occurrence of error. Have TA verify histogram.
(Note: Quantization error is the difference between quantized signal and original signal. Use the histogram function to plot in MATLAB.)
2, What does the x and y axis of the histogram mean?
On our histogram the x-axis represents the voltage value of the quantization error, while the y-axis represents the number of times the value has occurred in that time being 3, Create a signal been sampled at 12 bits. What would happen to the quantization error
as the number of bits is increased and why? The relationship between the number of bits and the quantization error, I seen to be as the bits increases the quantization error decreases, reason being the increase of the bits increases the number of quantization levels, allowing for a more accurate analog signal on the histogram/plot
THIS IS FOR BOTH A and B
fs = 1200; %sample rate
time_total = 0.1;
t= 1/1200:1/1200:time_total; %defining time on the axis
xt = 5.5*sin(2*pi*50*t) + 4.3*cos(2*pi*10*t); %defining the signal
bits = 10; %number of bits
xmin = -10; %voltage range
xmax = 10;
L = 2^bits; %quantining the signal
R = (xmax-xmin)/L;
n = length(t);
for idx = 1:n
i(idx) = round((xt(idx)-xmin)/R);
xq10(idx) = xmin + i(idx)*R;
end
figure;set(gcf, 'color'
, [1 1 1]);
plot(t,xt,
'b'
);
xlabel(
'time in sec'
)
ylabel(
'magnitude'
)
hold on
;
stairs(t,xq10,
'r'
);
legend(
'raw data'
,
'10 bits'
);
hold of
grid on
;
error10 = xt-xq10;
bits = 12;
L = 2^bits;
R = (xmax-xmin)/L;
n = length(t);
for idx = 1:n
i(idx) = round((xt(idx)-xmin)/R);
xq12(idx) = xmin+i(idx)*R;
end
error12 = xt-xq12;
figure;set(gcf,
'color'
,[1 1 1]);
histogram(error10); hold on
histogram(error12); hold of
xlabel(
'magnitude'
)
ylabel(
'number of occrurences'
)
legend(
'10bit'
,
'12bit'
);
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help