Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #2180 > unrolled thread
| Started by | trg818@gmail.com |
|---|---|
| First post | 2013-10-29 16:57 -0700 |
| Last post | 2013-10-30 16:18 +0100 |
| Articles | 4 — 2 participants |
Back to article view | Back to comp.graphics.apps.gnuplot
Fit with "multi-part" function? trg818@gmail.com - 2013-10-29 16:57 -0700
Re: Fit with "multi-part" function? Karl <mail.kfr@gmx.net> - 2013-10-30 10:43 +0100
Re: Fit with "multi-part" function? trg818@gmail.com - 2013-10-30 06:44 -0700
Re: Fit with "multi-part" function? Karl <mail.kfr@gmx.net> - 2013-10-30 16:18 +0100
| From | trg818@gmail.com |
|---|---|
| Date | 2013-10-29 16:57 -0700 |
| Subject | Fit with "multi-part" function? |
| Message-ID | <f393ddc2-46b5-4551-8d4f-de48d257ae4c@googlegroups.com> |
Hi, I have often successfully used Gnuplot's excellent fitting function, so I'm a bit perplexed by the problem I encounter now. Consider this: b2=1./(3.*delta0-1) fnaux(n,bn,x,y)=1.+(n/(3.*bn*KT0))*(x-rbsm*alpha0*KT0*(y-T0)) fn(n,bn,x,y)=1./(1.-bn+bn*(fnaux(n,bn,x,y))**(1./n))**3 Vth(x,y)=(V0/rbsm)*(fn(2,b2,x,y)-fn(2,b2,x,T0)) T0, KT0, and V0 are fixed constants, and what I try to do is: fit Vth(x,y) 'pV_db.dat' u 2:1:3 via alpha0,delta0,rbsm This results in a singular matrix, even though the initial guesses for alpha0,delta0,rbsm are close to the expected solution. My question really is this: can I not use auxiliary functions like b2, fnaux, fn for writing Vth when performing the fit? Or, in other words, will something like b2 remain fixed with the initial guess, even when the fitting procedure is supposed to vary delta0, on which b2 depends? This would obviously limit the complexity of function models I can use for fitting data with Gnuplot. Thomas
[toc] | [next] | [standalone]
| From | Karl <mail.kfr@gmx.net> |
|---|---|
| Date | 2013-10-30 10:43 +0100 |
| Message-ID | <l4qkcj$6u3$1@news.rz.uni-karlsruhe.de> |
| In reply to | #2180 |
Am 30.10.2013 00:57, schrieb trg818@gmail.com: > Hi, > I have often successfully used Gnuplot's excellent fitting function, so I'm a bit perplexed by the problem I encounter now. Consider this: > > b2=1./(3.*delta0-1) > fnaux(n,bn,x,y)=1.+(n/(3.*bn*KT0))*(x-rbsm*alpha0*KT0*(y-T0)) > fn(n,bn,x,y)=1./(1.-bn+bn*(fnaux(n,bn,x,y))**(1./n))**3 > Vth(x,y)=(V0/rbsm)*(fn(2,b2,x,y)-fn(2,b2,x,T0)) > > T0, KT0, and V0 are fixed constants, and what I try to do is: > > fit Vth(x,y) 'pV_db.dat' u 2:1:3 via alpha0,delta0,rbsm > > This results in a singular matrix, even though the initial guesses for alpha0,delta0,rbsm are close to the expected solution. > My question really is this: can I not use auxiliary functions like b2, fnaux, fn for writing Vth when performing the fit? Or, in other words, will something like b2 remain fixed with the initial guess, even when the fitting procedure is supposed to vary delta0, on which b2 depends? This would obviously limit the complexity of function models I can use for fitting data with Gnuplot. > > Thomas > "singular matrix" often means that you are trying to fit a parameter that does not appear in the respective function. delta0 does not appear in fnaux(), fn(), or Vth(), so you cannot fit "via delta0". b2=1./(3.*delta0-1) is not a function, so it does not get evaluated during fitting. You can declare b2(x)=1./(3.*x-1) and then replace all "b2" by "b2(alpha0)". Think it should work then. Karl
[toc] | [prev] | [next] | [standalone]
| From | trg818@gmail.com |
|---|---|
| Date | 2013-10-30 06:44 -0700 |
| Message-ID | <7b6d5d2d-ee8e-47cc-afff-37a6ac91f0bd@googlegroups.com> |
| In reply to | #2181 |
On Wednesday, October 30, 2013 10:43:40 AM UTC+1, Karl wrote: > delta0 does not appear in fnaux(), fn(), or Vth(), so you cannot fit > "via delta0". Well, at least not explicitly, but via b2 > b2=1./(3.*delta0-1) > is not a function, so it does not get evaluated during fitting. You can > declare > b2(x)=1./(3.*x-1) > and then replace all "b2" by "b2(alpha0)". Think it should work then. I guess that would be b2(delta0). Anyway, I tried both b2(x)=1./(3.*delta0-1), calling b2(x) as b2(x) with x being a dummy variable, and b2(delta0)=1./(3.*delta0-1), calling it as b2(delta0) as you suggested, but the error remains the same. Thomas
[toc] | [prev] | [next] | [standalone]
| From | Karl <mail.kfr@gmx.net> |
|---|---|
| Date | 2013-10-30 16:18 +0100 |
| Message-ID | <l4r7vj$j8k$1@news.rz.uni-karlsruhe.de> |
| In reply to | #2182 |
Am 30.10.2013 14:44, schrieb trg818@gmail.com: > On Wednesday, October 30, 2013 10:43:40 AM UTC+1, Karl wrote: >> delta0 does not appear in fnaux(), fn(), or Vth(), so you cannot fit >> "via delta0". > Well, at least not explicitly, but via b2 >> b2=1./(3.*delta0-1) >> is not a function, so it does not get evaluated during fitting. You can >> declare >> b2(x)=1./(3.*x-1) >> and then replace all "b2" by "b2(alpha0)". Think it should work then. > I guess that would be b2(delta0). Anyway, I tried both > b2(x)=1./(3.*delta0-1), > calling b2(x) as b2(x) with x being a dummy variable, and > b2(delta0)=1./(3.*delta0-1), > calling it as b2(delta0) as you suggested, but the error remains the same. Both should also work. It just doesn´t matter how you name the independent variable in a functions definition. Does the original fit work if you leave out delta0 in the "via" statement? You could create an artificial dataset for testing, just plot to a file after "set table". It´s clear why your initial function set gave the error, with delta0 not appearing in it. Karl
[toc] | [prev] | [standalone]
Back to top | Article view | comp.graphics.apps.gnuplot
csiph-web