summaryrefslogtreecommitdiff
path: root/matlab_usage_source
diff options
context:
space:
mode:
Diffstat (limited to 'matlab_usage_source')
-rw-r--r--matlab_usage_source/fitted_data_improved.pngbin0 -> 3478 bytes
-rw-r--r--matlab_usage_source/index.t2t68
2 files changed, 68 insertions, 0 deletions
diff --git a/matlab_usage_source/fitted_data_improved.png b/matlab_usage_source/fitted_data_improved.png
new file mode 100644
index 0000000..c7dbeb3
--- /dev/null
+++ b/matlab_usage_source/fitted_data_improved.png
Binary files differ
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 =