diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2013-09-06 17:39:55 -0400 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2013-09-06 17:39:55 -0400 |
commit | 5801b009075699997ce5e40e8d76f35d858dbe8e (patch) | |
tree | 5c80b532cedc46f53bf765c5accfa4f8935535b9 /matlab_usage_source/index.t2t | |
parent | 42ae1263a6c038433a0a8e1aea303998fd868ef5 (diff) | |
download | manual_for_Experimental_Atomic_Physics-5801b009075699997ce5e40e8d76f35d858dbe8e.tar.gz manual_for_Experimental_Atomic_Physics-5801b009075699997ce5e40e8d76f35d858dbe8e.zip |
fit section expanded
Diffstat (limited to 'matlab_usage_source/index.t2t')
-rw-r--r-- | matlab_usage_source/index.t2t | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/matlab_usage_source/index.t2t b/matlab_usage_source/index.t2t index d04efcd..bcc31ee 100644 --- a/matlab_usage_source/index.t2t +++ b/matlab_usage_source/index.t2t @@ -277,6 +277,74 @@ ylabel('Voltage (V)') [fitted_data.png] +This is not a very good fit since the fit line most of the times more than a typical experimental error away. + +== More elaborated fit == + +It looks like our voltage has some offset. We need to update our model to +include **``Vb``** the biasing voltage term: **``V = R*I +Vb``**. So in our +fit/model should include two unknown parameters **``R``** and **``+Vb``** + +``` +f=fittype( @(R, Vb, I) R*I+Vb, 'independent', 'I' ) +``` + +We need provide initial +guess for two parameters + +``` +param_guessed = [ 4, .5 ] +%_________________^ R value +%____________________^^ Vb value +``` + +The rest of the procedure is the same as above + +``` +[fitobject, goodness_of_fit] = fit (I, V, f, 'StartPoint', param_guessed) +``` + +and we see fit parameters **``R``** and **``+Vb``** below +``` + +fitobject = + + General model: + fitobject(I) = R*I+Vb + Coefficients (with 95% confidence bounds): + R = 0.9094 (0.5556, 1.263) + Vb = 1.165 (0.2817, 2.048) + +goodness_of_fit = + + sse: 0.3832 + rsquare: 0.9571 + dfe: 3 + adjrsquare: 0.9428 + rmse: 0.3574 +``` + +Let's see how our new fit looks like + +``` +figure(4) +fontSize=24; +set(gca,'FontSize',fontSize ); + +errorbar(I,V,dV, 'x') +hold on + +plot( fitobject ) + +title('Dependence of voltage on current') +xlabel('Current (A)') +ylabel('Voltage (V)') +``` + +[fitted_data_improved.png] + +This seems to be a much better fit. + = Saving you Matlab plots = |