sampling

sampling - Sampling and different methods of reconstruction...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Sampling and different methods of reconstruction --- a MATLAB experiment for Purdue ECE 301, by Prof. Chih-Chun Wang. Preparation (different from the previous MATLAB experiments) 1. Download the different wav files x1.wav (Save it as “x1.wav”.) 2. Download the following m files: ece301conv.m , ece301_sampler.m , ece301_ZOH.m , ece301_Lin.m , ece301_Opt.m . 3. Open MATLAB and change the directory to where you have saved the previous files. 4. Enter the following commands duration=8; f_sample=44100; t=(((0-4)*f_sample+0.5):((duration-4)*f_sample-0.5))/f_sample; Basic operations: 1. If you want to construct a sin wave with frequency 440Hz, use the following commands: f=440; s=sin(2*pi*f*t); If you want to construct a sinc function sinc(t), use the command: sc=sin(pi*t)./(pi*t); Note: every time you do vector multiplication or division, you need to add a period “.” before the “*” and “/” operator. 2. The convolution of two signals x1 and x2 can be achieved by the following command y=ece301conv(x1,x2); 3. If you would like to sample a continuous-time signal x with sampling period 0.02 sec, then use the following command. x=sin(t); T=0.2;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
[xn, sampling_index, sampling_locations]=ece301_sampler(x,T); If you would like to plot the new discrete time signal x[n], use the following command stem(sampling_index, xn); xlabel('n'); ylabel('x[n]'); If you would like to place the sampled values in their corresponding positions, use the following command plot(sampling_locations, xn, 'o'); xlabel('t (sec)'); ylabel('x(nT)'); Remark: Notice the change of the time-axis. You can also compare the continuous-time signal and the sampled values by plot(t, x, sampling_locations, xn, 'ro'); xlabel('t (sec)'); legend('x(t)', 'x(nT)'); Requirement: You are asked to plot several figures. Print all the figures for each objective. Your HW
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 6

sampling - Sampling and different methods of reconstruction...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online