This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
ecen_370_assignments [2015/06/23 12:25] graham |
ecen_370_assignments [2015/12/30 22:45] (current) nielson |
||
|---|---|---|---|
| Line 11: | Line 11: | ||
| | [[ecen_370_assignments#Homework 4|HW 4]] | Joint PMF, Marginal PMF, Expectation, Baye's Rule | [[matlab_guide#Matrix Operations| Matrix Operations]], [[matlab_guide#Plotting commands| Plotting commands]] | 2.4-2.6 | | | [[ecen_370_assignments#Homework 4|HW 4]] | Joint PMF, Marginal PMF, Expectation, Baye's Rule | [[matlab_guide#Matrix Operations| Matrix Operations]], [[matlab_guide#Plotting commands| Plotting commands]] | 2.4-2.6 | | ||
| | [[ecen_370_assignments#Homework 5|HW 5]] | Joint PMF, Expectation | [[matlab_guide#Matlab If-statement| If-statement]], [[matlab_guide#For-loop| For-loop]] | 2.7-3.1 | | | [[ecen_370_assignments#Homework 5|HW 5]] | Joint PMF, Expectation | [[matlab_guide#Matlab If-statement| If-statement]], [[matlab_guide#For-loop| For-loop]] | 2.7-3.1 | | ||
| - | | [[ecen_370_assignments#Homework 6|HW 6]] | Uniform RV, PDF, Exponential RV | [[matlab_guide#Function Files| Functions continued]] | 3.1-3.3 | | + | | [[ecen_370_assignments#Homework 6|HW 6]] | Uniform RV, PDF, Exponential RV | Review | 3.1-3.3 | |
| - | | [[ecen_370_assignments#Homework 7|HW 7]] | Marginal PDF, Conditional PDF, Expectation | [[matlab_guide#For-loop| Perform an Integral using a for-loop]] | 3.4-3.5 | | + | | [[ecen_370_assignments#Homework 7|HW 7]] | Marginal PDF, Conditional PDF, Expectation | Review | 3.4-3.5 | |
| | [[ecen_370_assignments#Homework 8|HW 8]] |PDF, CDF, Poisson RV | Review | 3.6-4.1 | | | [[ecen_370_assignments#Homework 8|HW 8]] |PDF, CDF, Poisson RV | Review | 3.6-4.1 | | ||
| - | | [[ecen_370_assignments#Homework 9|HW 9]] | N/A | [[matlab_guide#Roots| Polynomial Roots]], | 4.1-5.2 | | + | | [[ecen_370_assignments#Homework 9|HW 9]] | N/A | [[matlab_guide#Real and Imaginary Command| Correlation]] | 4.1-5.2 | |
| - | | ::: | ::: | [[matlab_guide#Real and Imaginary Command| Real and Imaginary Command]] | ::: | | + | |
| | [[ecen_370_assignments#Homework 10|HW 10]] |Central Limit Theorem | Review | 5.3-6.1 | | | [[ecen_370_assignments#Homework 10|HW 10]] |Central Limit Theorem | Review | 5.3-6.1 | | ||
| Line 31: | Line 30: | ||
| in a graph | in a graph | ||
| - | Syntax: load(sprintf('sequence%u.mat', k)); | + | Starter: load(sprintf('sequence%u.mat', k));, put inside a for loop of variable k (k replaces the %u in the name) |
| Functions to Learn: load(); sprintf(); bar(); | Functions to Learn: load(); sprintf(); bar(); | ||
| Line 52: | Line 51: | ||
| sequences you suspect are fraudulent. | sequences you suspect are fraudulent. | ||
| </file> | </file> | ||
| + | ==Files== | ||
| {{::hw2_matlab_example.m|}} | {{::hw2_matlab_example.m|}} | ||
| {{::coin_flip_data.zip|}} | {{::coin_flip_data.zip|}} | ||
| + | <ifauth @admin,@370ta> | ||
| ==Solution== | ==Solution== | ||
| {{::homework_2.m|}} | {{::homework_2.m|}} | ||
| {{::solution_graph.png?200|}} | {{::solution_graph.png?200|}} | ||
| + | </ifauth> | ||
| === Homework 3 === | === Homework 3 === | ||
| Line 66: | Line 67: | ||
| <file> | <file> | ||
| - | Objective: Understand the Random variables offered in matlab and how to plot them. | + | Objective: Understand the Random variables offered in Matlab and how to plot them. |
| - | Syntax: x_vector = random('Binomial', n, p, [1, trials]); | + | Starter: x_vector = random('Binomial', n, p, [1, trials]); |
| Functions to learn: var(), xlabel(), ylabel(), title() | Functions to learn: var(), xlabel(), ylabel(), title() | ||
| Line 98: | Line 99: | ||
| with the probability mass function you computed analytically? | with the probability mass function you computed analytically? | ||
| </file> | </file> | ||
| + | ==Files== | ||
| {{::hw3_matlab_example.m|}} | {{::hw3_matlab_example.m|}} | ||
| + | <ifauth @admin,@370ta> | ||
| ==Solution== | ==Solution== | ||
| {{::homework_3.m|}} | {{::homework_3.m|}} | ||
| Line 107: | Line 109: | ||
| {{::screenshot_from_2015-06-09_19_06_44.png?200|}} | {{::screenshot_from_2015-06-09_19_06_44.png?200|}} | ||
| - | | + | </ifauth> |
| === Homework 4 === | === Homework 4 === | ||
| Line 115: | Line 117: | ||
| Objective: Learn to plot a joint PMF | Objective: Learn to plot a joint PMF | ||
| - | Syntax: Refer to HW4_prob_example.m | + | Starter: Refer to HW4_prob_example.m |
| Functions to Learn: none | Functions to Learn: none | ||
| Line 157: | Line 159: | ||
| </file> | </file> | ||
| + | ==Files== | ||
| {{::simulate_joint_pmf.m|}} | {{::simulate_joint_pmf.m|}} | ||
| Line 163: | Line 166: | ||
| {{:burgerfry.zip|}} | {{:burgerfry.zip|}} | ||
| + | <ifauth @admin,@370ta> | ||
| ==Solution== | ==Solution== | ||
| {{::hw_4.m|}} | {{::hw_4.m|}} | ||
| Line 171: | Line 175: | ||
| {{:capture_2.png?200|}} | {{:capture_2.png?200|}} | ||
| + | </ifauth> | ||
| === Homework 5 === | === Homework 5 === | ||
| Line 179: | Line 183: | ||
| Objective: Simulate Joint Random Variables | Objective: Simulate Joint Random Variables | ||
| - | Syntax: P = zeros(2,2); | + | Starter: P = zeros(2,2); |
| Functions to Learn: none | Functions to Learn: none | ||
| Line 228: | Line 232: | ||
| </file> | </file> | ||
| + | <ifauth @admin,@370ta> | ||
| ==Solution== | ==Solution== | ||
| {{::hw5.m|}} | {{::hw5.m|}} | ||
| + | </ifauth> | ||
| === Homework 6 === | === Homework 6 === | ||
| Line 235: | Line 241: | ||
| <file> | <file> | ||
| - | Objective: | + | Objective: To simulate a 2D uniform random variable and obtain its PDF |
| - | Syntax: | + | Starter: Refer to continuous_sim_commented.m |
| - | Functions to Learn: | + | Functions to Learn: viscircle() may be helpful but not necessary |
| Bertsekas Chapter 3, Problem 7 | Bertsekas Chapter 3, Problem 7 | ||
| - | An example of this type of problem is in the file continuous_sim_commented.m. | ||
| One way to do this is to simulate a uniform distribution over a circle of radius 1 and then | One way to do this is to simulate a uniform distribution over a circle of radius 1 and then | ||
| compute the distance to each point: | compute the distance to each point: | ||
| Line 261: | Line 266: | ||
| histogram plot. It should look like the histogram for an exponential random variable! | histogram plot. It should look like the histogram for an exponential random variable! | ||
| </file> | </file> | ||
| + | ==Files== | ||
| {{::continuous_sim_commented.m|}} | {{::continuous_sim_commented.m|}} | ||
| + | |||
| + | <ifauth @admin> | ||
| ==Solution== | ==Solution== | ||
| {{::homework_6_graph_0.png?200|}} | {{::homework_6_graph_0.png?200|}} | ||
| {{::capture_0.png?200|}} | {{::capture_0.png?200|}} | ||
| + | </ifauth> | ||
| === Homework 7 === | === Homework 7 === | ||
| Line 271: | Line 280: | ||
| <file> | <file> | ||
| + | Objective: To simulate a 2D uniform random variable and obtain its marginal/conditional PDF | ||
| + | |||
| + | Starters: none | ||
| + | |||
| + | Functions to Learn: line() | ||
| + | |||
| Chapter 3, Problem 23 | Chapter 3, Problem 23 | ||
| From the previous homework assignment, you should be able to define a triangle and then create | From the previous homework assignment, you should be able to define a triangle and then create | ||
| Line 287: | Line 302: | ||
| c) Find E[Y] from simulation. | c) Find E[Y] from simulation. | ||
| </file> | </file> | ||
| + | |||
| + | <ifauth @admin,@370ta> | ||
| ==Solution== | ==Solution== | ||
| {{::homework_7_graph.png?200|}} | {{::homework_7_graph.png?200|}} | ||
| + | </ifauth> | ||
| === Homework 8 === | === Homework 8 === | ||
| Line 294: | Line 312: | ||
| <file> | <file> | ||
| + | |||
| + | Objective: To calculate sums and differences of R.V.s Plot the CDF | ||
| + | |||
| + | Starter: random('type', mean, rows, columns); | ||
| + | |||
| + | Functions to Learn: random() | ||
| + | |||
| This will show you how to simulate derived distributions. The file hw8.m on the website will show | This will show you how to simulate derived distributions. The file hw8.m on the website will show | ||
| you an example of appropriate graphs. Use 10,000 points for each of these problems. Turn in your | you an example of appropriate graphs. Use 10,000 points for each of these problems. Turn in your | ||
| Line 319: | Line 344: | ||
| d) Compare your plot with the analytic solution you derived above | d) Compare your plot with the analytic solution you derived above | ||
| </file> | </file> | ||
| + | ==Files== | ||
| + | {{::hw8.m|}} | ||
| + | |||
| + | <ifauth @admin,@370ta> | ||
| ==Solution== | ==Solution== | ||
| + | {{::chapter4_problem1.m|}} | ||
| + | |||
| + | {{:chapter4_problem5.m|}} | ||
| + | |||
| + | {{:chapter4_problem8.m|}} | ||
| + | |||
| + | {{:chapter_4_probl_1_graph.png?200|}} | ||
| + | |||
| + | {{:chapter_4_problem_5_graph.png?200|}} | ||
| + | |||
| + | {{:chapter_4_problem_8_graph.png?200|}} | ||
| + | </ifauth> | ||
| === Homework 9 === | === Homework 9 === | ||
| Line 325: | Line 366: | ||
| <file> | <file> | ||
| + | Objective: To find correlation between statistical data and understand what correlation means | ||
| + | |||
| + | Starter: rho = corr(X, Y); | ||
| + | |||
| + | Functions to Learn: corr() | ||
| + | |||
| I have taken the following from the CMU DASL statistics website: | I have taken the following from the CMU DASL statistics website: | ||
| http://lib.stat.cmu.edu/DASL/Data_les/carmpgdat.html | http://lib.stat.cmu.edu/DASL/Data_les/carmpgdat.html | ||
| Line 365: | Line 412: | ||
| d) Do the simulated values you computed in part (b) match the values in part (a)? | d) Do the simulated values you computed in part (b) match the values in part (a)? | ||
| </file> | </file> | ||
| + | |||
| + | <ifauth @admin,@370ta> | ||
| ==Solution== | ==Solution== | ||
| + | |||
| + | </ifauth> | ||
| === Homework 10 === | === Homework 10 === | ||
| Line 371: | Line 422: | ||
| <file> | <file> | ||
| + | |||
| + | Objective: To calculate the sum of R.V. and prove that their output is Gaussian | ||
| + | |||
| + | Starter: Refer to page 182 in the book | ||
| + | |||
| + | Functions to Learn: none | ||
| + | |||
| Viewing the Central Limit Theorem: | Viewing the Central Limit Theorem: | ||
| Perform the following for N variables = 1,2,3,5,10,100. | Perform the following for N variables = 1,2,3,5,10,100. | ||
| Line 379: | Line 437: | ||
| raw histogram by both the total number of points (estimate of probability per interval) and | raw histogram by both the total number of points (estimate of probability per interval) and | ||
| by the length of each interval (estimate of probability density per interval). | by the length of each interval (estimate of probability density per interval). | ||
| - | c) On the same graph as the histogram (use the “hold on” and “hold of” commands), plot a | + | c) On the same graph as the histogram (use the “hold on” and “hold off” commands), plot a |
| Gaussian (normal) random variable with the mean and standard deviation for Y. | Gaussian (normal) random variable with the mean and standard deviation for Y. | ||
| d) Compare the plots obtained in part b) and part c). | d) Compare the plots obtained in part b) and part c). | ||
| e) Do the means and standard deviations agree with what you found in part a)? | e) Do the means and standard deviations agree with what you found in part a)? | ||
| </file> | </file> | ||
| + | |||
| + | <ifauth @admin,@370ta> | ||
| ==Solution== | ==Solution== | ||
| + | {{::graph_hw10.png?200|}} | ||
| + | </ifauth> | ||