From: C. on 7 May 2010 04:03 Hello, I'm trying to fit one equation y=a*(b^c)*t to multiple plots. I've got 6 plots which should have the same a and b parameters, but c differs (c is 1:6). So it's in fact 6 equations which only differ in c, but a and b are the same. I've got all data sets in an array and i tried to use cftool to fit them, but cftool won't accept arrays because it only works with 1-dimensional Arrays of each data set. So i created one 1-dimensional array for each data set to plot them all in cftool and fit them, but that won't work sufficiently either because you get one set of paramters (a, b) for each plot and i just want one set of (a, b) for all c which gives me the best result when i fit every plot with that one set of parameters. Could it be that this is a 3-dimensional problem because my function has a t and c dependancy and i should use surface fit? Or is there another way to get my a and b? Thanks,
From: Walter Roberson on 7 May 2010 04:28 C. wrote: > Hello, > I'm trying to fit one equation y=a*(b^c)*t to multiple plots. > I've got 6 plots which should have the same a and b parameters, but c > differs (c is 1:6). I'm not sure from what you wrote, whether the c is known for each plot, or if the part of the task is to figure out which one is which? Is c integral? I figure duplicate c's are not possible because otherwise that would give duplicate y's.
From: C. on 7 May 2010 04:32 c is 1 for the first plot, 2 for the second and so on... There are multiple equations i'd like to fit to multiple data sets, but i have to get one setof parameters a, b. Walter Roberson <roberson(a)hushmail.com> wrote in message <LaQEn.418$V%2.304(a)newsfe08.iad>... > C. wrote: > > Hello, > > I'm trying to fit one equation y=a*(b^c)*t to multiple plots. > > I've got 6 plots which should have the same a and b parameters, but c > > differs (c is 1:6). > > I'm not sure from what you wrote, whether the c is known for each plot, > or if the part of the task is to figure out which one is which? Is c > integral? I figure duplicate c's are not possible because otherwise that > would give duplicate y's.
From: John D'Errico on 7 May 2010 04:59 "C. " <vogel.jan(a)googlemail.com> wrote in message <hs0j69$pc5$1(a)fred.mathworks.com>... > c is 1 for the first plot, 2 for the second and so on... > There are multiple equations i'd like to fit to multiple data sets, but i have to get one setof parameters a, b. > > > > Walter Roberson <roberson(a)hushmail.com> wrote in message <LaQEn.418$V%2.304(a)newsfe08.iad>... > > C. wrote: > > > Hello, > > > I'm trying to fit one equation y=a*(b^c)*t to multiple plots. > > > I've got 6 plots which should have the same a and b parameters, but c > > > differs (c is 1:6). > > > > I'm not sure from what you wrote, whether the c is known for each plot, > > or if the part of the task is to figure out which one is which? Is c > > integral? I figure duplicate c's are not possible because otherwise that > > would give duplicate y's. NO. You cannot do this fit. It is not possible to estimate both a and b here. Not even if c is fixed at some SINGLE value! Whoever has told you that it is possible is wrong. The curve fitting toolbox cannot give you a valid answer, even if you were to use a loop. To understand why this is true, imagine that we were to solve the problem using a loop. That is, fix the values of c in a loop. Thus... for c = 1:6 % estimate the values of a,b, given the value of c ... end So now, we can imagine that the value of c is fixed. On the first pass through the loop, c will be 1. That would mean that there was an optimal value for a and b, such that y = a*b*t. Piick some value for a and b that ANY curve fitting tool would generate, if it could do so. But then (2*a) and (b/2) would be as good solutions, since y = a*b*t = (2*a)*(b/2)*t In fact, for ANY value of k, we get the SAME result. y = a*b*t = (k*a)*(b/k)*t My point is, the solution is non-unique. There is NO optimal solution. The same result applies when c is not 1. We can still find an infinite non-unique family of results. You will not be able to solve this problem. John
From: Walter Roberson on 7 May 2010 09:45
C. wrote: > c is 1 for the first plot, 2 for the second and so on... There are > multiple equations i'd like to fit to multiple data sets, but i have to > get one setof parameters a, b. > > > Walter Roberson <roberson(a)hushmail.com> wrote in message > <LaQEn.418$V%2.304(a)newsfe08.iad>... >> C. wrote: >> > Hello, >> > I'm trying to fit one equation y=a*(b^c)*t to multiple plots. >> > I've got 6 plots which should have the same a and b parameters, but >> c > differs (c is 1:6). >> >> I'm not sure from what you wrote, whether the c is known for each >> plot, or if the part of the task is to figure out which one is which? >> Is c integral? I figure duplicate c's are not possible because >> otherwise that would give duplicate y's. okay, in that case, y{1} = a*(b^1)*t so a*(b^1)=y{1} ./ t a*(b^2)=y{2} ./ t divide the second by the first bh{2} = (y{2} ./ t) / (y{1} ./ t) and likewise for the other y{k} vs y{k-1} Now take a weighted average of the bh. On a finite precision machine, the first of them should be the most accurate if b>1 and the last of them should be the most accurate if b<1. Now, if a*(b^1)=y{1} ./ t then a = y{1} ./ t ./ b^1 a = y{2} ./ t ./ b^2 and so on, so calculate the right hand sides and take a weighted average of them. If we did not know the order of the plots, then we could deduce it by examining the bh{} values, except that since we would then not have a sorting direction, I think there would be two possible answers for b in that case (but I haven't sorted that point out for sure... there's only so much one can do in one's dreams.) |