BMEN 3311 Fall 2022 Midterm Exam_kerlos iskandar

.docx

School

University of North Texas *

*We aren’t endorsed by this school

Course

3311

Subject

Electrical Engineering

Date

Jan 9, 2024

Type

docx

Pages

6

Uploaded by BrigadierDiscovery640

Report
BMEN 3311 Fall 2022 Midterm Exam – MATLAB Section Student Name: Kerlos Iskandar Student ID: 11433392 Submit your report using word or pdf format. Your report should include your MATLAB code and results. (40points) Q1, Consider three sinusoids with the following amplitudes and phases: a). Create a MATLAB program to sample each sinusoid and generate a sum of three sinusoids, that is, x[n]= x 1 [n]+ x 2 [n]+ x 3 [n], using a sampling rate of 6,000 Hz. Plot x[n] over a range of 0.1 seconds. (15 points). b). Compute the DFT coefficients, using the for loop and equation method, and plot the power
%Q1 %part A % generate the sine wave sequence fs=6000; T=1/fs; % Sampling rate and sampling period t=0:T:0.1; x1=5*cos(2*pi*500*t); x2=5*cos(2*pi*1200*t+0.25*pi); x3=5*cos(2*pi*1800*t+0.5*pi); x=x1+x2+x3; %part B % apply the FFT algorithm for N=length(x) index_t=[0:1:N-1]; f=[0:1:N-1]*fs/N; %Map frequency bin to frequency (Hz) X_pow=abs(fft(x))/N; %Calculate power spectrum X_phase =angle(fft(x)); end subplot(3,1,1); plot(t,x); grid xlabel( 'Time(sec.)' );ylabel( 'Signal x(n)' ); subplot(3,1,2); plot(f,X_pow); grid xlabel( 'Frequency (Hz)' );ylabel( 'Power Spectrum' ); subplot(3,1,3); plot(f,X_phase); grid xlabel( 'Frequency (Hz)' );ylabel( 'Phase Spectrum' );
(60 points) Q2. Given a signal waveform, x ( t ) = 3.25sin ( 2 π × 50 t ) + 1.25cos ( 2 π × 100 t + π 4 ) ,for t ≥ 0 , sample it at 1000 samples per second and with a total length of 0.1 second. (1) Write a MATLAB program to quantize x(t) using a 4-bit bipolar quantizer to obtain the quantized signal x q , assuming that the signal range to be from - 5 to 5V; Plot the original signal and quantized signal; You need to plot these signals in one figure. (20 points). (2) Calculate the Fourier transform of the x(t) use two different number of Fourier coefficients: N1 = 64 and N2 = 2048. Plot one-sided amplitude and phase spectrum under each Fourier Transform result. Using the subplot function to plot all spectrum in one figure. (30 points) (3) Indicate the intrinsic frequency(s) in each Fourier Transform result; Identify the phase value in the intrinsic frequency(s); Are the value the same in N1=64 and N2 = 1024 cases? If not, why they are different. (10 points). close all fs = 1000; %sampling frequency in H2 t_total = 0.1; % second T = 1/fs; t = T:T:t_total; %max sampling xt = 3.25*sin(2*pi*50*t)+1.25*cos (2*pi*100*t+pi/4); bits = 4; xmin = -5; %V
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