Linearized Regression Examplefitting a theoretical function to experimental stress-strain dataProvided experimental data:≔σT2250 3575 4250 4350 4250[[]]≔εT⋅500 10−6⋅1000 10−6⋅1500 10−6⋅2000 10−6⋅2375 10−6⎡⎣⎤⎦≔n length((ε))=n 5≔i ‥0−n 1Theoretical nonlinear function to be fit with linearized regression:=σ ⋅⋅aεe⋅−bεTaking the natural log of both sides:=ln((σ))−+ln((a))ln((ε))⋅bε=−ln((σ))ln((ε))−ln((a))⋅bε=ln⎛⎜⎝―σε⎞⎟⎠−ln((a))⋅bε=Y +a0⋅a1X≔Xiεi≔Yiln⎛⎜⎜⎜⎝―σiεi⎞⎟⎟⎟⎠≔a1slope((,XY))=a1−492.333≔a0intercept((,XY))=a015.577≔aa0=a ⋅5.823 106≔b −a1=b 492.333Cihdd dli ffiiNon-Commercial Use OnlyComputing the standard error and correlation coefficient:≔xε ≔yσ ≔f((x))⋅⋅ax⋅−bx≔x_bar――∑ixin=x_bar 0.001 ≔y_bar――∑iyin=y_bar ⋅3.735 103≔St∑i⎛⎝−yiy_bar⎞⎠2=St⋅3.14 106≔Sr∑i⎛⎝−yif⎛⎝xi⎞⎠⎞⎠2=Sr⋅8.815 103≔sy_x‾‾‾‾‾――Sr−n 2=sy_x54.205≔r‾‾‾‾‾‾―――−StSrSt=r 0.9986Plotting the results:≔xmin0≔xmaxmax((x))≔Δx――――−xmaxxmin100≔xf ,‥xmin+xminΔx xmax9001.35⋅10³1.8⋅10³2.25⋅10³2.7⋅10³3.15⋅10³3.6⋅10³4.05⋅10³04504.5⋅10³5⋅10⁻⁴ 7.5⋅10⁻⁴ 0.001 0.001 0.002 0.002 0.002 0.0020 2.5⋅10⁻⁴ 0.003yif((xf))xixfNon-Commercial Use OnlyA better alternative to fitting the linearized equation is to use MathCad to do a nonlinear fit directly, using numerical optimization:Define the data vectors:≔vx =ε⋅510−40.0010.0020.0020.002⎡⎢⎢⎢⎢⎢⎣⎤⎥⎥⎥⎥⎥⎦≔vy =σ⋅2.25 103⋅3.575 103⋅4.25 103⋅4.35 103⋅4.25 103⎡⎢⎢⎢⎢⎢⎣⎤⎥⎥⎥⎥⎥⎦Define the function using a vector of unknown parameters:=σ ⋅⋅aεe⋅−bε≔F((,xa))⋅⋅a0x⋅−a1xDefine initial guesses for the function parameters:=guessa0a1⎡⎢⎢⎣⎤⎥⎥⎦≔guess100000100⎡⎢⎣⎤⎥⎦Have MathCAD solve for the optimal function parameters to fit the data:≔a =genfit((,,,vx vy guess F))⋅5.898 106498.933⎡⎢⎣⎤⎥⎦≔fg((x))F((,xa))Calculate the correlation coefficient:≔fitifg⎛⎝vxi⎞⎠=corr((,fit vy))0.9992Non-Commercial Use OnlyComparing the results:9001.35⋅10³1.8⋅10³2.25⋅10³2.7⋅10³3.15⋅10³3.6⋅10³4.05⋅10³04504.5⋅10³5⋅10⁻⁴ 7.5⋅10⁻⁴ 0.001 0.001 0.002 0.002 0.002 0.0020 2.5⋅10⁻⁴ 0.003yif((xf))fg((xf))xixf xfNon-Commercial Use
View Full Document