hw8_solution - 10:58 AM clear clc ta x=[48.4 47.1 49.5 116...

Info icon This preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4/7/09 10:58 AM C:\Documents and Settings\Kevin Haas\My Documents\c...\rayleigh.m 1 of 3 clear clc %Data x=[48.4 47.1 49.5 116 84.1 99.3 108.1 47.3 93.7 36.3 122.5 52.7 44.5 84.8 52.6 53.6 33.5 43.8 56.3 34.5 62.8 180.5 42.4 146.2 115.2 43 103.6 64.7 69.8 44 36.2 50.6 %Number of samples %Specify bin locations % x<45 % 45<X<70 % 70<X<95 % 95<X<120 % x>120 %Plot frequency histogram figure(2) clf
Image of page 2
4/7/09 10:58 AM C:\Documents and Settings\Kevin Haas\My Documents\c...\rayleigh.m 2 of 3 subplot(311) bar(w,ni, 'histc' ) grid on xlabel( 'Strain (micro-in/in)' ) ylabel( 'Number of Observations' ) set(gca, 'xlim' ,[0 max(x)]) %Compute the fraction and plot subplot(312) bar(w,fi, 'histc' ) grid on xlabel( 'Strain (micro-in/in)' ) ylabel( 'Fraction of Observations' ) set(gca, 'xlim' ,[0 max(x)]) %Plot the density for i=1:numbin end subplot(313) bar(w,den, 'histc' ) grid on xlabel( 'Strain (micro-in/in)' ) ylabel( 'Probability Density' ) set(gca, 'xlim' ,[0 max(x)]) %Find moments and parameters %Plot the theoretical pdf subplot(313) hold on plot(x,f, 'r.' ) %Find the theoretical frequency for each bin %Put upper limit to infinity %Find the CDF at each bin border %Find the prob of each bin by difference of CDF %theoretical frequency %Perform Chi-squared test % Critical value from table A.4 A=0.01 f=3 disp( 'Perform Chi-squared test' ) disp([ 'Error = ' ,num2str(err), ' C_crit = '
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4/7/09 10:58 AM C:\Documents and Settings\Kevin Haas\My Documents\c...\rayleigh.m 3 of 3 if err<c_crit disp( 'Passes Chi-squared test' ) else disp( 'Fails Chi-squared test' ) end
Image of page 4
4/7/09 10:59 AM MATLAB Command Window 1 of 1 Perform Chi-squared test Error = 4.1683 C_crit = 11.3449 Passes Chi-squared test >>
Image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Bins ni ei (ni-ei)^2/ei 0<x<45 9.000 8.362 0.049 45<x<70 12.000 8.366 1.578 70<x<95 3.000 7.299 2.532 95<x<120 5.000 4.842 0.005 x>120 4.000 4.131 0.004 Total 4.168
Image of page 6
0 20 40 60 80 100 120 140 160 180 0 2 4 6 8 10 12 Strain (micro-in/in) Number of Observations 0 20 40 60 80 100 120 140 160 180 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 Strain (micro-in/in) Fraction of Observations 0 20 40 60 80 100 120 140 160 180 0 0.005 0.01 0.015 Strain (micro-in/in) Probability Density
Image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4/7/09 11:02 AM C:\Documents and Settings\Kevin Haas\My Documents\...\conc_plot.m 1 of 4 clear clc %Load the data load conc.dat % Number of samples % Bin width % Find the histogram %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Part (a) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Plot histogram figure(2) clf subplot(311) bar(xi,ni,1) grid on xlabel( 'Concentration (ppm)' ) ylabel( 'Number of Observations' ) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Part (b) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Compute the fraction and plot subplot(312) bar(xi,fi,1) grid on xlabel( 'Concentration (ppm)' ) ylabel( 'Fraction of Observations' ) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Part (c) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Plot the probability density subplot(313) bar(xi,fi/w,1) grid on xlabel( 'Concentration (ppm)' ) ylabel( 'Probability Density' ) %Find moments and parameters of the distributions % Initialize a concentration variable for theoretical plots
Image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern