Exercise 1: Statistical analysis - a methodological experiment in MF2024, 2011 Ulf Olofsson KTH Machine Design School of Industrial Engineering and Management MF2024 Robust and probabilistic design School of Industrial Engineering and Management October 2011 EXERCISE 1 – STATISTICAL ANALYSIS The exercise • The exercise requires Matlab R2009b, or higher • It is a group exercise (2 persons per group) • Analyze the four physical experiments performed in lecture 1 (two snap fastener tests and two paper clip test) The basic procedure 1 Open Matlab and create a new Matlab M-file. 2 Create a vector for the set “The number of cycles to fatigue for the paper clips (22 clips, 22 testers)” of different bending cycle test values –the data are available in appendix A. 3 Plot a histogram (number of similar results against the number of cycles of the data set. Some useful Matlab commands are shown in appendix B. 4 Find the parameters for the Normal, Exponential, 2-parameter Weibull, and 3parameter Weibull distributions, and plot each distribution together with the histogram in the same plot (use the hold on/hold off Matlab commands) . 5 Plot the transformed linear representation of the four distributions in 4. 6 Determine and motivate which distribution that you have found is the best representation of the data set. 7 Repeat steps 2-6 for the three other data sets. 8 Type your results, paste your plots into the report template. Add your Matlab code in appendix ( C) at the end of the report. Don´t forget to type your names on the front page. 9 Send the report to mf2024@md.kth.se. The e-mail must also include the subject “Exercise 1” 1 APPENDIX A: TEST DATA Below is the data from the four tests that were performed at Lecture 1, October 24, presented as Matlab vectors. The number of cycles to fatigue for the paper clips (22 clips, 22 testers): nclip=[7 7 9 3.5 4 8 7 6 5 6 7 7 9 8 8 9 3 9 7 6 7.5 5]; The number of cycles to fatigue for the paper clips (20 clips, 1 tester): nclipn1=[8 5 5 6 3 4 4 5 5 8 5 5 4 5 5 5 7 6 5 8]; The measured force (N) for the snap fastener (22 fasteners, 22 testers): nsnapnn=[6.2 11.7 10 8.4 5.6 16.7 16.3 16.7 9.8 11.7 9.8 14.3 19 11 10.6 13.5 6.5 6.8 8.8 6 7.1 7.5] The measured force (N) for the snap fastener (20 fasteners, 1 tester): nsnapn1=[9.8 10.6 8.8 12.4 9.8 10.5 11 12.2 12.5 14 11.5 12.4 13.5 9.7 10.9 9.9 7.5 9.8 13.4 12.4] 2 APPENDIX B: MATLAB SOURCE CODE EXAMPLE % Exercise.m % Clip bending % % Ulf Sellgren, 20101029 % nclip=[5 10 6 5 12 6 5 6 7 4 9 8 5 5 7 6 7 6 8 10 4 7 4 8 8 10 13 9 3 12 10 7] ; x0=0; % Weibull third parameter (threshold value) nclip=nclip-x0; %% %bending cycles to failure % iplot=1 ; figure(iplot) hist(nclip,20) iplot=iplot+1 ; figure(iplot) %subplot(2,2,1) probplot('normal',nclip) % Normal distribution probability plot %subplot(2,2,2) iplot=iplot+1 ; figure(iplot) probplot('exponential',nclip) % Exponential distribution probability plot %subplot(2,2,[3 4]) iplot=iplot+1 ; figure(iplot) probplot('weibull',nclip) % 2-param Weibull probability plot x=0:0.1:30 ; [ir,ic]=size(x) ;% % ______________________________________________________ % normal distribution iplot=iplot+1 ; [nmean,nsigma]=normfit(nclip) % alt nmean=mean(nc); nsigma=std(nc); fnormal=normpdf(x,nmean,nsigma); Fnormal=normcdf(x,nmean,nsigma) f_norm=@(x)normpdf(x,nmean,nsigma); Fnint5=quad(f_norm,-100,5) % probability of failure in the interval [0,5] % for ii=1:ic Fnint(ii)=normcdf(x(ii),nmean,nsigma) ; end Rnint=1-Fnint ; % figure(iplot) subplot(2,1,1) plot(x,fnormal) title('Normal probability density function') xlabel('# of cycles') ylabel('Frequency') subplot(2,1,2) plot(x,Fnint,x,Rnint) title('Normal survival plot') xlabel('# of cycles') ylabel('Survival/death probability') % % ______________________________________________________ % exponental distribution 3 iplot=iplot+1 ; mu=expfit(nclip) lambda=1/mu fexp=exppdf(x,1/lambda); Fexp=expcdf(x,mu) figure (iplot) subplot(2,1,1) plot(x,fexp) title('Exponential probability density function') xlabel('# of cycles') ylabel('Frequency') f_lambda=@(x)exppdf(x,1/lambda); Feint5=quad(f_lambda,0,5) % probability of failure in the interval [0,5] % for ii=1:ic Feint(ii)=expcdf(x(ii),1/lambda) ; end Reint=1-Feint ; subplot(2,1,2) plot(x,Feint,x,Reint) title('Exponential survival plot') xlabel('# of cycles') ylabel('Survival/death probability') % % % ______________________________________________________ % Weibul distribution iplot=iplot+1; parmhat=wblfit(nclip); scale=parmhat(1) shape=parmhat(2) fwbl=wblpdf(x,scale,shape) ; figure(iplot) subplot(2,1,1) plot(x,fwbl) title('Weibull probability density function') xlabel('# of cycles') ylabel('Frequency') f_wei=@(x)wblpdf(x,scale,shape); Pw5=quad(f_wei,0,5) % probability of failure in the interval [0,5] Fw5=wblcdf(5,scale,shape) % failure probability at a level of 5 Rw5=1-Fw5 % function reliability at a level of 5 for ii=1:ic Fwbl(ii)=wblcdf(x(ii),scale,shape) ; end Rwbl=1-Fwbl ; subplot(2,1,2) plot(x,Fwbl,x,Rwbl) title('Weibull survival plot') xlabel('# of cycles') ylabel('Survival/death probability') % ______________________________________________________________ 4