Professional Documents
Culture Documents
HW 18 Random Number Generation Interpolation
HW 18 Random Number Generation Interpolation
ProfessorSureshAcharya
Engin136
06April2015
HW#18RandomNumberGeneration,Interpolation
Chapter7#14,22
Q14
n=1000
y=2*randn(1,n)+20
mean_y=mean(y)
s=std(y)
variance_y=s^2
x=[round(min(y)):round(max(y))]
hist(y,x),xlabel(RandomValues),ylabel(AbsoluteFrequency)
disp(Thepercentwithinonestandarddeviationofthemeanis:)
percent=100*sum((y>=(mean_ys))&(y<=(mean_y+s)))/n
>>hw18_14
mean_y=
19.9347
variance_y=
3.9917
Theresultsgiveamean19.9347,as
comparedtothetruevalueof20,anda
varianceof3.9917,ascomparedtothe
truevalueof4.
Q22
x=[1234678101112]
y=[1091824212018151311]
x_int=[59]
interp1(x,y,x_int)
ans=
22.500016.5000
Theestimatedtemperaturesat5pmand9pmare22.5and16.5,respectively.