<Announcements>

Lab 0:

  1. If you don't have a CAEN account and so can't log in, please visit CAEN office (in Media Union, 2nd floor) and get an account.

  2. Please email me if you can't find your lab partner. I hope I can help you find one.

 

Lab 1:

  1. Homework 2 was modified due to some problems. Make sure to download the new hw2 from website. (We thank Amanda Wallace for raising a question about hw2 and making us modify it.) 
  2. Append all your matlab codes to the report. For problems 1-3, you can copy all commands from command history window and paste them on your report. Make sure to show which code corresponds to which problem.
  3. Hints on the lab assignment 1:

    Prob 1(c):  Given that you have all discrete-time statistics from 1(b), you need to find all corresponding continuous-time statistics by using Ts=1/100. (ex) duration = Ts * (# of samples)

    Prob 2(c): Note that the signal "clarinet" has a sampling frequency 22050 Hz, which means 22050 samples/sec. You can find the answer in samples by plotting it and then convert it in seconds by using the sampling frequency.

 

Lab 2:

  1. If you didn't pick up your graded hw or lab report, you can find it in Rm 4338 EECS (GSI room). Ask any GSI in the room when you stop by during the office hour.

  2. Hints on lab assignments:

    Prob. 2(a): Note that all signals in the code are column vectors, not row vectors. Buffer should be a column vector!

    Prob. 3(b): cor1 = run_corr(cs1, dsss). Signal "cs1" comes first.

    Prob. 4(c): sum(condition) will be useful to count the number of samples that satisfy the given condition. (ex) when x = [1 2 3 4 5 6], try to run "sum(x<3)".

     

Lab 3:

  1. Open Lab next week. You can visit any lab section for review for the upcoming exam.

  2. Make sure to turn in your HW and report next week. Both of HW and report are due on the same time, the same day as usual.

  3. HW2 corrections: 1(e) E(x) = infinity, M(x) = 0, MS(x) = 1/2, RMS(x) = 1/sqrt(2). Because this was caused by the wrong solution we made, you can bring your HW to get it regraded next week. (Lab policy does NOT apply this time!) 

  4. In lab #6, please the following people (Leif Alfenas, Si-Wayne Long, Nicole C, Illi Eisner) need to email me and let me know (1) your UMID, (2) all scores of HWs and reports, and (3) some explanation on the missing HWs and reports, because your names are not on the roster list that I currently have. 

  5. Hints on lab assignments:

    Prob. 1(a): When x(t) = A cos(wt+p), the "phasor" means A exp(jp), where A is an amplitude, w is a frequency in rad/sec, and p is a phase.

    Prob. 2(c): Ts (sampling interval) can be easily found from the difference between two sample points. This also applies to the implementation of "fape.m".

    Prob. 2(e): When you need to store the amplitude and phase in two vectors (say, A_vec and PHI_vec) in the for loop, you must define them before the for loop as A_vec = [] and PHI_vec = [] if you want to use something like A_vec(k) and PHI_vec(k) in the loop. Nothing but the square brackets!

    Prob. 3(a) & (b): When you plot the figures, you need to use stem() and abs() because the returned correlation vector contains complex numbers. 

    Prob. 3(c): You need to use the equation (3.54) in your lab manual to find the speed of the object.

 

Lab 4a:

  1. Your exams were returned. If you missed this week's lab, please stop by the GSI room and pick up your exam.

  2. LAB 4 is divided to 2 parts. 

    LAB 4a (This week) : Manual p.65-70, Lab assignments 1, 2, 3. (Due next week as usual)

    LAB 4b (Next week) : Manual p.70-76, Lab assignments 4, 5. (Due on Mar 5 after the spring break)

  3. Some students asked us to double-check if the solution to Problem 6(a) of HW4 is correct. The solution is correct. Please read it one more time. If you have any disagreement with it, you can bring your work back and show it to me next week. Thank you for raising a question about the solution.  

  4. Hints on lab assignments:

    <Prob. 2> The coefficients "a_k" were given in the manual. You need to use the command as follows. 

    [signal, tt] = fourier_synthesis(CC, T, m);     % you do NOT have to put the 4th argument!

    where T, m are specified in the manual and CC = [a_(-20), a_(-19), ..., a_(19), a_(20)] by using the equation given. You can use either "for loop" or "vector" to make CC.  In addition, don't forget that the "magnitude" of the coefficient can NOT be negative! 

    <Prob. 3(b)-(d)> You need to use just 1 period of data from step_signal. Note that 1 period of data have 16384 samples

    <Prob. 3(b)> Plot the magnitude and the phase spectrum respectively. Be careful to put the right values when you use stem(arg1, arg2). Note that 1st argument is x-values and 2nd is y-values in the figure!

    <Prob. 3(c)> You do nearly the same thing as 3(b). But you need to repeat it 4 times with N=25, 50, 100, 200.

    <Prob. 3(d)> You do the same thing as 3(c). But you need to repeat it a lot more than 4 times to find the smallest N that makes MSE less than 5% of MSV.

      

Lab 4b:

  1. HW#4 correction: 6(a) phase = pi*f1 or -pi*f1. The right answer is -pi*f1. However, you may come up with pi*f1 if you use the equation given in the HW, which has a typo. So we will give you a full credit even if pi*f1 is not correct. Please bring your HW back to me if this correction applies to yours.

  2. Hints on lab assignments:

    <Prob. 4>  

    Coefficients vector index starts from 1, even though coefficient index k starts from 0.

    Frequency is in radian/sample, NOT in Hz.

    <Prob. 5(a)> 

    You use the first 0.5-sec signal which contains 4096 samples.

    "Identify the frequencies contained in each of the two harmonic series present in signal" means that you need to list all harmonic frequencies where the magnitude is not zero. 

    <Prob. 5(b)> You use the second 0.5-sec signal.

    <Prob. 5(c)> Find all k's of noise signal in the spectrum.

    <Prob. 5(d)> Put all k's of noise signal in the zc vector in the code "fix_melody.m".

    <Prob. 5(e)> If you put all correct k's of noise signal, your returned signal is supposed to have a checksum of 0.42348 when you run melody_check(result).

      

Lab 5:

  1. HW #6,7 and Lab 4a were returned. Please check out the updated scores on the web page. 

  2. Exam review next week. You can visit any lab section for it. But make sure to turn in your lab report to me on the due date as usual.

  3. Hints on lab assignments:

    <Prob. 1-3>  

    Each picture must have a colorbar. Make sure to run all of the following commands for each picture: (1) imagesc(your image file), (2) colorbar, (3) colormap(gray), (4) axis image.

    Converting an image matrix (say, cm) to an array (say, cm_array): 

            cm_array = cm(:);

    <Prob. 2>  

    You can use quantize_fdn( ) for 64 level quantization of cm as follow: 

    [cm64, delta] = quantize_fcn(cm, 64, 0, 255); 

     cm64 is the quantized image, delta is the space between levels. 

    Plotting a histogram with 256 bins.

    hist(cm64(:), 0:255); 

    Error image is (the original image - the returned image).

    er64 = cm - cm64;

    L=2^b level means b bits/pixel. (ex) 64 (=2^6) level corresponds to 6 bits/pixel. 

    <Prob. 3(a)>

    Plotting a band image.  

    band0_image = A(:,:,1) and band7_image = A(:,:,8) when A = dft_block(cm).

    Use axis square for this one, NOT axis image. 

    <Prob. 3(c)> 

    Plot the original image, NOT the error image.

    Direct quantizer = quantize_fcn( ), Transform coder = dft_coder( ).

    Don't forget to put semicolon (;) at the end of dft_coder( ). Otherwise, you cannot see the table that you need to refer to.

      

Lab 6:

  1. HW #8 was returned. But not the report and exam yet. Sorry!   

  2. Hints on lab assignments:

    <Probs. 1-4>  

    Using our new function to display a picture and the new inline function to compute MS can save a lot of time:

    <img.m> (Make this new m-file and save it as "img.m") 

    %  USAGE: img(picture);          % display a "picture"

    function img(x)

    imagesc(x); axis image; colormap(gray); colorbar;

     

    <ms> (Just type the below, NOT the comments, in the MATLAB command window) 

    %  USAGE: ms(pic1-pic2);         % MSE of "pic1" & "pic2"

    ms = inline('mean(x(:).^2)');

    <Prob. 1>  

    No surprise even if you got a larger MSE after filtering. Note that smoothing does NOT mean eliminating the noise.

    Using g_smooth( ) to obtain filter coefficients (say b): 

            b = g_smooth(0.5);              % when the width = 0.5

    <Prob. 2>  

    Using the 2-dimensional g_smooth2( ) to obtain filter coefficients (say bb): 

    bb = g_smooth2(5);                % when the width = 5 

    <Prob. 3>

    Using the median filter medfilt1( ) with an image (say my_img for input and img_med for output):  

    img_med = medfilt1(medfilt1(my_img, 3)', 3)';            % when the order = 3

    <Prob. 4> 

    First difference filter coefficients (say b):

    b = [1 -1];                   % y[n] = x[n] - x[n-1]

    Edge-finding filter coefficients (say b):

    b = [0.25  -1  0.25;  -1  3  -1;  0.25  -1  0.25];            % this is given in the manual

    Using the sharpen filter sharpen( ) with an image (say my_img for input and img_sh for output):  

    img_sh = sharpen(my_img,  5);           % when the strength = 5

      

Lab 7:

  1. Please go to Prof. Fessler's office to pick up your exam.   

  2. HW#9 and LAB#5 were returned.

  3. Next week, Fred and Wen-Chiao will teach LAB#5 and #6, respectively. They are much better than me !!! 

  4. If you have any questions about your graded HW and report next week, you SHOULD bring it back to "ME" a week after next week. Please DO NOT bother Fred and Wen-Chiao !!!

  5. Hints on lab assignments:

    <Prob. 1>  

    sig in the file "dtmf_dial.m" is a column vector. So you need to use semicolon(;) to append a new value to the previous one.

    First sig is to append the sum of 2 cosine functions for 0.5 sec.

    Second sig is to append zeros for 0.1 sec. You need to figure out how many zeros to put, based on the sampling frequency fs.

    <Prob. 2>  

    Gain-ratio R = (largest gain)/(2nd largest gain). Gain is the absolute value of H(w), i.e., abs(H)

    Optimal value of M is the smallest M that makes R local maximum.

    Associated center frequency gain is the maximum gain when using the optimal M above.

    Resulting value R is the maximum R above.

    <Prob. 3>

    M = a vector of the optimal M's for each frequency. There are 7 frequencies to deal with.

    G = a vector of associated center frequency gains for each frequency.

    h = impulse response, the same as 2(a).

    h_smooth = given in the problem.

    <Prob. 4> 

    Change noise powers to get the success rate around 0.5 not close to 0 or 1. This means "some but not all trials fail". Success rate is the value that "dtmf_attack.m" returns.