SlideShare a Scribd company logo
Data Analysis Homework
Help
For any help regarding Matlab Assignment Help visit :
https://www.matlabassignmentexperts.com/ ,
Email - info@matlabassignmentexperts.com or call us at - +1 678 648 4277
Matlab Homework Help
Problem 1 Computing joint probabilities and correlations of a time series
Suppose that the total streamflows (in m3
/month) Qt and Qt+1 over two successive
months t and t+1 are related by the following equation:
Qt+1 = 0.6Qt + et t = 1....10
In deterministic applications such time series expressions are solved one step at a
time, starting with a specified value of the initial value of the dependent (in this case,
the initial streamflow Q1) and using a specified series of et values (for t = 10). The
resultis a series of Qt values for t > 1.
When Q1 and the et values are uncertain, we can use the time series equation to derive
the mean, variance, and covariance of the streamflow for t > 1. These give a
probabilistic description of the temporally variable streamflow.
Suppose that the random excitation values e1 … e10 are independent normally
distributed random variables, each with mean 4.0 and variance 0.64 (standard
deviation 0,8). In addition, suppose that the initial streamflow Q1 is normally
distributed with mean 10.0 and variance 1.0 (standard deviation 1.0). Assume that Q1
and the et values are independent.
Use the definitions of variance and correlation to evaluate the correlation between the
two successive streamflows Q2 and Q3. First use the defining time series difference
equation and the properties of the mean and variance of a linear function to find the
means and variances of Q2 and Q3. Then use the same equation to derive an
expression for the covariance and correlation between Q2 and Q3. Are Q2 and Q3
independent? Why? What do you think you would get for the means and variances of
Q9 and Q10. Why?
Use MATLAB to determine the joint probability that Q2 and Q3 are both greater than
12.0. Also, plot a typical replicate of streamflow vs. time.
Some relevant MATLAB functions: normrnd, sum
Computing and Data Analysis for Environmental Applications
Matlab Homework Help
Solution:
To find the mean and variance of Q2 and Q3: Q2 =
0.6Q1 + e1
E[Q2] = 0.6(10) + 4 =10
Q3 = .6(.6Q1 + e1)+e2
E[Q3] = .36(10)+.6(4)+4 =10
If the Qi’s are independent:
Var[a1Q1+a2Q2+…+anQn] = a1
2
Q1
2
+…+an
2
2
Qn
Apply to the difference equations for Q2 and Q3 :
Var[Q2] = (.6)2
(1)2
+(.8)2
= 1
Var[Q3] = (.36)2
(1)2
+(.6)2
(.8)2
+(.8)2
= 1
Find the correlation between Q2 andQ3:
Correl(Q2,Q3) = Cov(Q2,Q3)/(Var[Q2]*Var[Q3])
e2 )(Q2-Q2 )]
Cov(Q2,Q3) = E[(Q2-Q2 )(Q3-Q3 )]
Q3- Q3= 0.6(Q2- Q2 )+(e2 e2 )
E[(Q2-Q2 )( Q3-Q3 )] = 0.6*E[(Q2-Q2 )2
]+E[(e2
= 0.6*Var[Q2] + Cov(Q2,e2)
What is Cov(Q2,e2)?
e2 )]+
Note: Q2- Q2 = 0.6(Q1- Q1)+(e1 e1) Then:
Cov(Q2,e2) = E[ (Q2- Q2 )( e2
E[ (e1 e1 )(e2
e2 )] = 0.6* E[(Q1-Q1)(e2
e2 )]
From the problem statement, Q1 is independent of the ei’s, and the ei’s are independent of each
other, Therefore:
Cov(Q2,e2) = E[ (Q2-Q2 )(e2 e2 )] = 0
And:
Cov(Q2,Q3) = 0.6*Var[Q2]+Cov(Q2,e2) = 0.6*Var[Q2] = 0.6
Correl(Q2,Q3) = 0.6/(1*1) = 0.6
Matlab Homework Help
MATLAB solution to second part of problem.
Problem 2 The Central Limit Theorem(solution)
The Central Limit Theorem states that the distribution of a linear function of independent
random variables approaches the normal distribution as the number of variables increases. Use
MATLAB to demonstrate this by carrying out the following virtual experiment:
Generate a random array of 1000 replicates (rows) each consisting of 32 independent
identically distributed sample values (columns), using one of the non-normal random number
generators provided in the MATLAB statistics toolbox (e.g. exponential, uniform, lognormal,
etc.). Select your own values for all required distributional parameters. Plot histograms and
CDFs (over all replicates) for the sample mean:
N
i 1
1
N
xi
mx
For N= 1, 4, 16, and 64. Plot all 4 CDFs on the same axis using the MATLAB normplot
function, which displays normally distributed data as a straight line.Your CDFs should more
closely approach a straight line as Nincreases, indicating convergence to a normal probability
distribution. The approach to normality should also be apparent in your 4 histograms (try
plotting all four on one page, using the MATLAB subplot function)
Some relevant MATLAB functions: exprnd, chi2rnd, lognrnd, hist,
normplot, mean, subplot.
Matlab Homework Help
% Problem Set 5
% Problem 1
clear all
close all
nrep=1000000;
emu=4;
esigma=.8;
qmu=10;
qsigma=1;
% create a matrix of random e's
emat=normrnd(emu,esigma,nrep,9);
% create the Q matrix
Qmat = zeros(nrep,10);
Qmat(:,1) = normrnd(qmu,qsigma,nrep,1);
for i=2:10
Qmat(:,i) = 0.6*Qmat(:,i-1)+emat(:,i-1);
End
% to get the correlation, need mean of (Q2-Q2bar)*(Q3-Q3bar) divided by
% sqrt [var(Q2)*var(Q3)]
Q2bar=mean(Qmat(:,2));
Q3bar=mean(Qmat(:,3));
numerator = mean((Qmat(:,2)-Q2bar).*(Qmat(:,3)-Q3bar));
denominator = sqrt(var(Qmat(:,2))*var(Qmat(:,3)));
correl = numerator/denominator
covariance = numerator
Matlab Homework Help
vect = Qmat(:,2)>12 & Qmat(:,3)>12;
jointprob = sum(vect)/nrep
plot(1:10,Qmat(5,:),'-*')
xlabel('Time')
ylabel('Streamflow')
title('Sample Streamflow vs. Time')
% One set of results:
%correl =
% 0.6007
% covariance =
% 0.6012 %
jointprob =
% 0.0057
Matlab Homework Help
% Problem Set 5
% Problem 2
clear all
close all
nrep=1000;
mat=exprnd(5,nrep,64);
m1=mat(:,1);
m4=sum(mat(:,1:4),2)/4;
m16=sum(mat(:,1:16),2)/16;
m64=sum(mat(:,1:64),2)/64;
figure
subplot(2,2,1), hist(m1)
subplot(2,2,2), hist(m4)
subplot(2,2,3), hist(m16)
subplot(2,2,4), hist(m64)
figure
normplot(m1)
hold normplot(m4)
normplot(m16)
normplot(m64)
legend('N=1','N=4','N=16','N=32')
Matlab Homework Help

More Related Content

What's hot (20)

PPTX
Statistics Homework Help
Statistics Homework Helper
 
PPTX
Machnical Engineering Assignment Help
Matlab Assignment Experts
 
PPTX
Electrical Engineering Assignment Help
Matlab Assignment Experts
 
PPTX
Stochastic Processes Homework Help
Statistics Assignment Help
 
PDF
Solution 3.
sansaristic
 
PPT
Numerical Methods
ESUG
 
PPT
5.1 greedy 03
Krish_ver2
 
PPTX
Computer Science Assignment Help
Programming Homework Help
 
PPT
Environmental Engineering Assignment Help
Matlab Assignment Experts
 
PPTX
Signal Processing Assignment Help
Matlab Assignment Experts
 
PPS
Greedy Algorithms with examples' b-18298
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
PDF
Assignment 2 daa
gaurav201196
 
PPTX
Digital Signal Processing Assignment Help
Matlab Assignment Experts
 
PDF
Answers withexplanations
Gopi Saiteja
 
PPT
5.1 greedy
Krish_ver2
 
DOC
algorithm Unit 4
Monika Choudhery
 
PPTX
Ms nikita greedy agorithm
Nikitagupta123
 
PDF
Algorithm chapter 9
chidabdu
 
PDF
Ee693 questionshomework
Gopi Saiteja
 
PPTX
DSP System Homework Help
Matlab Assignment Experts
 
Statistics Homework Help
Statistics Homework Helper
 
Machnical Engineering Assignment Help
Matlab Assignment Experts
 
Electrical Engineering Assignment Help
Matlab Assignment Experts
 
Stochastic Processes Homework Help
Statistics Assignment Help
 
Solution 3.
sansaristic
 
Numerical Methods
ESUG
 
5.1 greedy 03
Krish_ver2
 
Computer Science Assignment Help
Programming Homework Help
 
Environmental Engineering Assignment Help
Matlab Assignment Experts
 
Signal Processing Assignment Help
Matlab Assignment Experts
 
Greedy Algorithms with examples' b-18298
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
Assignment 2 daa
gaurav201196
 
Digital Signal Processing Assignment Help
Matlab Assignment Experts
 
Answers withexplanations
Gopi Saiteja
 
5.1 greedy
Krish_ver2
 
algorithm Unit 4
Monika Choudhery
 
Ms nikita greedy agorithm
Nikitagupta123
 
Algorithm chapter 9
chidabdu
 
Ee693 questionshomework
Gopi Saiteja
 
DSP System Homework Help
Matlab Assignment Experts
 

Similar to Data Analysis Homework Help (20)

PDF
Dr. Shivu___Machine Learning_Module 2pdf
Dr. Shivashankar
 
PPTX
Data Analysis Assignment Help
Statistics Assignment Help
 
PDF
Principal components
Hutami Endang
 
PPTX
3.2 measures of variation
leblance
 
PPT
Coefficient of Variation Business statstis
AbdullahAbdullah76320
 
PPT
Probability and statistics
Neil MacIntosh
 
PDF
Measure of Dispersion final.pdf
anshududhe
 
PDF
Measure of Dispersion final.pdf
anshududhe
 
PDF
Using R Tool for Probability and Statistics
nazlitemu
 
PPT
R for Statistical Computing
Mohammed El Rafie Tarabay
 
PDF
Multivriada ppt ms
Faeco Bot
 
PDF
exercises.pdf
mekuannintdemeke
 
PDF
Simulation exponential
Karen Yang
 
DOCX
1 Lab 4 The Central Limit Theorem and A Monte Carlo Si.docx
jeremylockett77
 
PDF
Big_DM_24_MS_Topic_02_Understanding Data.pdf
sadiakhann68
 
PDF
Functions
StudsPlanet.com
 
DOCX
Scanned by CamScanner s iO re W . th th e.docx
kenjordan97598
 
DOCX
De vry math 221 all discussion+ilbs latest 2016 november 1
lenasour
 
PPTX
Measures of dispersion - united world school of business
Unitedworld School Of Business
 
PPTX
Chapter 12
Tara Kissel, M.Ed
 
Dr. Shivu___Machine Learning_Module 2pdf
Dr. Shivashankar
 
Data Analysis Assignment Help
Statistics Assignment Help
 
Principal components
Hutami Endang
 
3.2 measures of variation
leblance
 
Coefficient of Variation Business statstis
AbdullahAbdullah76320
 
Probability and statistics
Neil MacIntosh
 
Measure of Dispersion final.pdf
anshududhe
 
Measure of Dispersion final.pdf
anshududhe
 
Using R Tool for Probability and Statistics
nazlitemu
 
R for Statistical Computing
Mohammed El Rafie Tarabay
 
Multivriada ppt ms
Faeco Bot
 
exercises.pdf
mekuannintdemeke
 
Simulation exponential
Karen Yang
 
1 Lab 4 The Central Limit Theorem and A Monte Carlo Si.docx
jeremylockett77
 
Big_DM_24_MS_Topic_02_Understanding Data.pdf
sadiakhann68
 
Functions
StudsPlanet.com
 
Scanned by CamScanner s iO re W . th th e.docx
kenjordan97598
 
De vry math 221 all discussion+ilbs latest 2016 november 1
lenasour
 
Measures of dispersion - united world school of business
Unitedworld School Of Business
 
Chapter 12
Tara Kissel, M.Ed
 
Ad

More from Matlab Assignment Experts (20)

PPTX
Digital Communication Through Biorthogonal Codes: A MATLAB Assignment Solution
Matlab Assignment Experts
 
PPTX
Solution to MATLAB Assignment on Signals and Systems
Matlab Assignment Experts
 
PPTX
🚀 Need Expert MATLAB Assignment Help? Look No Further! 📊
Matlab Assignment Experts
 
PPTX
Matlab Assignment Help
Matlab Assignment Experts
 
PPTX
Matlab Assignment Help
Matlab Assignment Experts
 
PPTX
Matlab Assignment Help
Matlab Assignment Experts
 
PPTX
MAtlab Assignment Help
Matlab Assignment Experts
 
PPTX
Matlab Assignment Help
Matlab Assignment Experts
 
PPTX
Matlab Assignment Help
Matlab Assignment Experts
 
PPTX
Matlab Homework Help
Matlab Assignment Experts
 
PPTX
MATLAB Assignment Help
Matlab Assignment Experts
 
PPTX
Matlab Homework Help
Matlab Assignment Experts
 
PPTX
Matlab Assignment Help
Matlab Assignment Experts
 
PPTX
Computer vision (Matlab)
Matlab Assignment Experts
 
PPTX
Online Matlab Assignment Help
Matlab Assignment Experts
 
PPTX
Modelling & Simulation Assignment Help
Matlab Assignment Experts
 
PPTX
Mechanical Assignment Help
Matlab Assignment Experts
 
PPTX
CURVE FITING ASSIGNMENT HELP
Matlab Assignment Experts
 
PPTX
Design and Manufacturing Homework Help
Matlab Assignment Experts
 
PPTX
Digital Image Processing Assignment Help
Matlab Assignment Experts
 
Digital Communication Through Biorthogonal Codes: A MATLAB Assignment Solution
Matlab Assignment Experts
 
Solution to MATLAB Assignment on Signals and Systems
Matlab Assignment Experts
 
🚀 Need Expert MATLAB Assignment Help? Look No Further! 📊
Matlab Assignment Experts
 
Matlab Assignment Help
Matlab Assignment Experts
 
Matlab Assignment Help
Matlab Assignment Experts
 
Matlab Assignment Help
Matlab Assignment Experts
 
MAtlab Assignment Help
Matlab Assignment Experts
 
Matlab Assignment Help
Matlab Assignment Experts
 
Matlab Assignment Help
Matlab Assignment Experts
 
Matlab Homework Help
Matlab Assignment Experts
 
MATLAB Assignment Help
Matlab Assignment Experts
 
Matlab Homework Help
Matlab Assignment Experts
 
Matlab Assignment Help
Matlab Assignment Experts
 
Computer vision (Matlab)
Matlab Assignment Experts
 
Online Matlab Assignment Help
Matlab Assignment Experts
 
Modelling & Simulation Assignment Help
Matlab Assignment Experts
 
Mechanical Assignment Help
Matlab Assignment Experts
 
CURVE FITING ASSIGNMENT HELP
Matlab Assignment Experts
 
Design and Manufacturing Homework Help
Matlab Assignment Experts
 
Digital Image Processing Assignment Help
Matlab Assignment Experts
 
Ad

Recently uploaded (20)

PPSX
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PPTX
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
PPTX
How to Manage Access Rights & User Types in Odoo 18
Celine George
 
PPTX
BANDHA (BANDAGES) PPT.pptx ayurveda shalya tantra
rakhan78619
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PPTX
Views on Education of Indian Thinkers Mahatma Gandhi.pptx
ShrutiMahanta1
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PPTX
Views on Education of Indian Thinkers J.Krishnamurthy..pptx
ShrutiMahanta1
 
PDF
Federal dollars withheld by district, charter, grant recipient
Mebane Rash
 
PDF
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
PPTX
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
PDF
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
PDF
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
PPTX
PPT on the Development of Education in the Victorian England
Beena E S
 
PDF
1, 2, 3… E MAIS UM CICLO CHEGA AO FIM!.pdf
Colégio Santa Teresinha
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PDF
Zoology (Animal Physiology) practical Manual
raviralanaresh2
 
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
How to Manage Access Rights & User Types in Odoo 18
Celine George
 
BANDHA (BANDAGES) PPT.pptx ayurveda shalya tantra
rakhan78619
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
Views on Education of Indian Thinkers Mahatma Gandhi.pptx
ShrutiMahanta1
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
Views on Education of Indian Thinkers J.Krishnamurthy..pptx
ShrutiMahanta1
 
Federal dollars withheld by district, charter, grant recipient
Mebane Rash
 
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
PPT on the Development of Education in the Victorian England
Beena E S
 
1, 2, 3… E MAIS UM CICLO CHEGA AO FIM!.pdf
Colégio Santa Teresinha
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
Zoology (Animal Physiology) practical Manual
raviralanaresh2
 

Data Analysis Homework Help

  • 1. Data Analysis Homework Help For any help regarding Matlab Assignment Help visit : https://www.matlabassignmentexperts.com/ , Email - [email protected] or call us at - +1 678 648 4277 Matlab Homework Help
  • 2. Problem 1 Computing joint probabilities and correlations of a time series Suppose that the total streamflows (in m3 /month) Qt and Qt+1 over two successive months t and t+1 are related by the following equation: Qt+1 = 0.6Qt + et t = 1....10 In deterministic applications such time series expressions are solved one step at a time, starting with a specified value of the initial value of the dependent (in this case, the initial streamflow Q1) and using a specified series of et values (for t = 10). The resultis a series of Qt values for t > 1. When Q1 and the et values are uncertain, we can use the time series equation to derive the mean, variance, and covariance of the streamflow for t > 1. These give a probabilistic description of the temporally variable streamflow. Suppose that the random excitation values e1 … e10 are independent normally distributed random variables, each with mean 4.0 and variance 0.64 (standard deviation 0,8). In addition, suppose that the initial streamflow Q1 is normally distributed with mean 10.0 and variance 1.0 (standard deviation 1.0). Assume that Q1 and the et values are independent. Use the definitions of variance and correlation to evaluate the correlation between the two successive streamflows Q2 and Q3. First use the defining time series difference equation and the properties of the mean and variance of a linear function to find the means and variances of Q2 and Q3. Then use the same equation to derive an expression for the covariance and correlation between Q2 and Q3. Are Q2 and Q3 independent? Why? What do you think you would get for the means and variances of Q9 and Q10. Why? Use MATLAB to determine the joint probability that Q2 and Q3 are both greater than 12.0. Also, plot a typical replicate of streamflow vs. time. Some relevant MATLAB functions: normrnd, sum Computing and Data Analysis for Environmental Applications Matlab Homework Help
  • 3. Solution: To find the mean and variance of Q2 and Q3: Q2 = 0.6Q1 + e1 E[Q2] = 0.6(10) + 4 =10 Q3 = .6(.6Q1 + e1)+e2 E[Q3] = .36(10)+.6(4)+4 =10 If the Qi’s are independent: Var[a1Q1+a2Q2+…+anQn] = a1 2 Q1 2 +…+an 2 2 Qn Apply to the difference equations for Q2 and Q3 : Var[Q2] = (.6)2 (1)2 +(.8)2 = 1 Var[Q3] = (.36)2 (1)2 +(.6)2 (.8)2 +(.8)2 = 1 Find the correlation between Q2 andQ3: Correl(Q2,Q3) = Cov(Q2,Q3)/(Var[Q2]*Var[Q3]) e2 )(Q2-Q2 )] Cov(Q2,Q3) = E[(Q2-Q2 )(Q3-Q3 )] Q3- Q3= 0.6(Q2- Q2 )+(e2 e2 ) E[(Q2-Q2 )( Q3-Q3 )] = 0.6*E[(Q2-Q2 )2 ]+E[(e2 = 0.6*Var[Q2] + Cov(Q2,e2) What is Cov(Q2,e2)? e2 )]+ Note: Q2- Q2 = 0.6(Q1- Q1)+(e1 e1) Then: Cov(Q2,e2) = E[ (Q2- Q2 )( e2 E[ (e1 e1 )(e2 e2 )] = 0.6* E[(Q1-Q1)(e2 e2 )] From the problem statement, Q1 is independent of the ei’s, and the ei’s are independent of each other, Therefore: Cov(Q2,e2) = E[ (Q2-Q2 )(e2 e2 )] = 0 And: Cov(Q2,Q3) = 0.6*Var[Q2]+Cov(Q2,e2) = 0.6*Var[Q2] = 0.6 Correl(Q2,Q3) = 0.6/(1*1) = 0.6 Matlab Homework Help
  • 4. MATLAB solution to second part of problem. Problem 2 The Central Limit Theorem(solution) The Central Limit Theorem states that the distribution of a linear function of independent random variables approaches the normal distribution as the number of variables increases. Use MATLAB to demonstrate this by carrying out the following virtual experiment: Generate a random array of 1000 replicates (rows) each consisting of 32 independent identically distributed sample values (columns), using one of the non-normal random number generators provided in the MATLAB statistics toolbox (e.g. exponential, uniform, lognormal, etc.). Select your own values for all required distributional parameters. Plot histograms and CDFs (over all replicates) for the sample mean: N i 1 1 N xi mx For N= 1, 4, 16, and 64. Plot all 4 CDFs on the same axis using the MATLAB normplot function, which displays normally distributed data as a straight line.Your CDFs should more closely approach a straight line as Nincreases, indicating convergence to a normal probability distribution. The approach to normality should also be apparent in your 4 histograms (try plotting all four on one page, using the MATLAB subplot function) Some relevant MATLAB functions: exprnd, chi2rnd, lognrnd, hist, normplot, mean, subplot. Matlab Homework Help
  • 5. % Problem Set 5 % Problem 1 clear all close all nrep=1000000; emu=4; esigma=.8; qmu=10; qsigma=1; % create a matrix of random e's emat=normrnd(emu,esigma,nrep,9); % create the Q matrix Qmat = zeros(nrep,10); Qmat(:,1) = normrnd(qmu,qsigma,nrep,1); for i=2:10 Qmat(:,i) = 0.6*Qmat(:,i-1)+emat(:,i-1); End % to get the correlation, need mean of (Q2-Q2bar)*(Q3-Q3bar) divided by % sqrt [var(Q2)*var(Q3)] Q2bar=mean(Qmat(:,2)); Q3bar=mean(Qmat(:,3)); numerator = mean((Qmat(:,2)-Q2bar).*(Qmat(:,3)-Q3bar)); denominator = sqrt(var(Qmat(:,2))*var(Qmat(:,3))); correl = numerator/denominator covariance = numerator Matlab Homework Help
  • 6. vect = Qmat(:,2)>12 & Qmat(:,3)>12; jointprob = sum(vect)/nrep plot(1:10,Qmat(5,:),'-*') xlabel('Time') ylabel('Streamflow') title('Sample Streamflow vs. Time') % One set of results: %correl = % 0.6007 % covariance = % 0.6012 % jointprob = % 0.0057 Matlab Homework Help
  • 7. % Problem Set 5 % Problem 2 clear all close all nrep=1000; mat=exprnd(5,nrep,64); m1=mat(:,1); m4=sum(mat(:,1:4),2)/4; m16=sum(mat(:,1:16),2)/16; m64=sum(mat(:,1:64),2)/64; figure subplot(2,2,1), hist(m1) subplot(2,2,2), hist(m4) subplot(2,2,3), hist(m16) subplot(2,2,4), hist(m64) figure normplot(m1) hold normplot(m4) normplot(m16) normplot(m64) legend('N=1','N=4','N=16','N=32') Matlab Homework Help