Starting from:

$30

    CmpE 362 Homework 1 Solved

                                                
 

For problems 1-6, write a script called HW1_firstpart.m and put all the commands in it. Separate and label different problems using comments. 

Problem 1
Let t is vector of real numbers (-2:0.01:2):  

plot y1 = sin(2*pi*t), y2= sin(2*pi*10*t), y3=10*sin(2*pi*t), y4= sin(2*pi*t)+10, y5= sin(2*pi*(t0.5)), y6= 10*sin(2*pi*10*t), y7= t* sin(2*pi*t), y8= sin(2*pi*t)/t , y9= y1+…+y8. Use 5x2 subplot to fit all subfigures belong to a single figure (Hint: write help for SUBPLOT in MATLAB). For more information about these functions, you can look Chapter 2: Sinusoids in your textbook. Problem 2 

randn generates zero-mean, unit variance Gaussian distributed random number. Generate 401 random numbers following Gaussian distributed random numbers, call this as vector z. Multiply

all z with 0.1. Plot y10= z, y11 = z+t , y12= z+y1, y13= z*y1, y14=t*sin(2*pi*z), y15= sin(2*pi*(t+z)), y16= z*y2, y17= sin(2*pi*(t+10*z)), y18=y1/z, y19= y11+…+y18. Use 5x2 subplot to fit all subfigures belong to a single figure.  Problem 3 

rand generates uniformly distributed random number between 0 and 1. Generate 401 random numbers following uniformly distributed random numbers, call this as vector z. Multiply all z with 0.1. Plot y20= z, y21 = z+t , y22= z+y1, y23= z*y1, y24=t*sin(2*pi*z), y25= sin(2*pi*(t+z)), y26= z*y2, y27= sin(2*pi*(t+10*z)), y28=y1/z, y29= y21+…+y28. Use 5x2 subplot to fit all subfigures belong to a single figure.  

Problem 4
Starting with z (0,1) Gaussian(Normal) Random variable. (Use help menu for hist) a. Generate 5000 random variables with mean 0, variance 1; call it r1 vector

b.  Generate 5000 random variables with mean 0, variance 8; call it r2 vector

c.   Generate 5000 random variables with mean 0, variance 64; call it r3 vector

d.  Generate 5000 random variables with mean 0, variance 256; call it r4 vector Plot hist(r1), hist(r2), hist(r3), hist(r4) on the same figure for comparison purposes.

Problem 5
Starting with z (0,1) Gaussian Random variable. (Use help menu for hist)

a.  Generate 5000 random variables with mean 10, variance 1; call it r6 vector

b.  Generate 5000 random variables with mean 20, variance 4; call it r7 vector

c.   Generate 5000 random variables with mean -10, variance 1; call it r8 vector

d.  Generate 5000 random variables with mean -20, variance 4; call it r9 vector Plot hist(r6), hist(r7), hist(r8),hist(r9) on the same figure for comparison purposes.

 

Problem 6 
Starting with z uniformly distributed random variable.

 

a.  Generate 5000 random variables with between -4 and 4; call it r11 vector

b.  Generate 5000 random variables with between -20 and 20; call it r21 vector

 

Plot hist(r11), hist(r21) on the same figure.

For problems 7 and 8, you may check ps-code in Canvas.

Problem 7
Please load the workspace called “mysignal.mat” There, you will find a x-signal, time and frequency. Using fft and fftshift functions, please include the mathematical formula of the signal in your report. (the values of coefficients are not important)

Problem 8 (Bonus)
Please, record your favorite song for 5 seconds and analyze it using fft and fftshift. It is enough just to include time and frequency plot in your reports.  

Problem 9
You are provided an image with the name lena.png which is commonly used in image processing studies.

First read the image with imread function. After that, convert this rgb image into a grayscale image by using rgb2gray method. Then you will compute the mean, standard deviation, maximum (and location of maximum), minimum (and location of minimum) of the matrix you obtained from the image.

 

Report Preparation
Put the figures and explanations about questions into your report. Report must be a pdf file. Briefly describe what you have learnt from the above plots (plots from Questions 1-6) in your report.



More products