## Description

1 Description

1.1 Problem 1

For problems 1-8, write a script called signalAndNoise.m and put all the commandsin it. Separate and

label different problems using comments.

Let x is vector of real numbers (-100:100)

plot y1 = sinx, y2=sin50x, y3=50sinx, y4= sinx+50,y5= sin(x+50),y6= 50sin50x, y7= x*sinx,

y8=sinx/x

Use 4×2 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.

1.2 Problem 2

Let x is vector of real numbers (-20:20)

Plot y1 = sinx, y2=sin50x, y3=50sinx, y4= sinx+50,y5= sin(x+50),y6= 50sin50x, y7= x*sinx,

y8=sinx/x , y9= y1+y2+y3+y4+y5+y6+y7+y8

Use 5×2 subplot to fit all subfigures belong to a single figure. For more information about these functions,

you can look Chapter 2: Sinusoids in your textbook.

1.3 Problem 3

randn generates zero-mean, unit variance Gaussian distributed random number in (-,) . Generate 41

random numbers following Gaussian distributed random numbers, call this as vector z.

Plot y10= z, y11 = z+x , y12= z+sinx, y13= z sinx, y14=xsinz, y15= sin(x+z), y16= zsin50x, y17=sin(x+50z)

y18=sinx/z, y19= y11+y12+y13+y14+y15+y16+y17+y18

Use 5×2 subplot to fit all subfigures belong to a single figure. For more information about these functions,

you can look Chapter 2: Sinusoids in your textbook.

1.4 Problem 4

rand generates uniformly distributed random number in [0,1] . Generate 41 random numbers following uniformly distributed random numbers.

Plot y20= z, y21 = z+x , y22= z+sinx, y23= z sinx, y24=xsinz, y25= sin(x+z), y26= zsin50x,

y27=sin(x+50z) y28=sinx/z, y29= y21+y22+y23+y24+y25+y26+y27+y28

Use 5×2 subplot to fit all subfigures belong to a single figure.

1.5 Problem 5

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

a. Generate 10000 random variables with mean 0, variance 1; call it r1 vector

b. Generate 10000 random variables with mean 0, variance 4; call it r2 vector

c. Generate 10000 random variables with mean 0, variance 16; call it r3 vector

d. Generate 10000 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.

1.6 Problem 6

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

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

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

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

d. Generate 10000 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.

1.7 Problem 7

Starting with z (0,1) uniformly distributed random variable.

a. Generate 10000 random variables with mean 0, variance 1; call it r11 vector

b. Generate 10000 random variables with mean 0, variance 4; call it r21 vector

c. Generate 10000 random variables with mean 0, variance 16; call it r31 vector

d. Generate 10000 random variables with mean 0, variance 256; call it r41 vector

Plot hist(r11), hist(r21), hist(r31),hist(r41) on the same figure for comparison

purposes.

2

1.8 Problem 8

Starting with z (0,1) uniformly distributed random variable. (Use help menu for hist)

a. Generate 10000 random variables with mean 10, variance 1; call it r61 vector

b. Generate 10000 random variables with mean 20, variance 4; call it r71 vector

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

d. Generate 10000 random variables with mean -20, variance 4; call it r91 vector

Plot hist(r61), hist(r71), hist(r81),hist(r91) on the same figure for comparison

purposes.

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-8) in your

report. Furthermore, briefly describe what you have learnt about MATLAB. What were the

challenges that you faced? What are the differences (advantages and disadvantages) between

MATLAB and the other programming languages you have learned so far?

3 Submission and Grading

Prepare a report (pdf file) includes your code , explanations and comments of your code for each

question. Compress the report and code files. Name it as ”YourNumber_CmpE362_HW1.rar.

Upload the file by using canvas before the deadline.

4 Notes

Deadline is strict. Do not send after deadline. When copying is detected, both parties will get zero.

3

1.9 Problem 9

You are given an input csv file: exampleSignal.csv). Determine all the peaks for the provided .csv file. You

can use built-in findpeaks method. Plot this signal on time domain and mark detected peaks by using

MATLAB plot function properties. Examine this plot by looking at it and analyze the peaks that you have

found or missed. Describe reasons why the algorithm missed some peaks by demonstrating examples in

your report. Create a script called problem10.m for this question.

1.10 Problem 10

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.

2 Report Preperation