Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Can FindFit handle two dependent variables?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg72252] Re: Can FindFit handle two dependent variables?
  • From: "Valeri Astanoff" <astanoff at gmail.com>
  • Date: Sat, 16 Dec 2006 05:18:18 -0500 (EST)
  • References: <elu3tt$gk$1@smc.vnet.net>


On 15 déc, 13:20, "lsha" <l... at earthlink.net> wrote:
> Hi,
>
> I have a set of two dimensional data in the form {{x1,y1},{x2,y2}...}.
> The data is mapped from another set of 2-D data in the form {{u1,v1},{u2,v2}...}.
> I know FindFit can work with 2-D data but only with one depedent variable in the form {x,y,f[x,y]}.
> Is there a way to use FindFit to solve the mapping from {u,v} to {x,y} simultaniously?
>
> Thanks,
> lsha

Hi,

Here is a toy example of what you can do :

In[1]:= xy =
{{2,1},{3,2},{4,3},{5,4},{6,5},{3,2},{4,4},{5,6},{6,8},{7,8}};

In[2]:= uv =
{{1,1},{1,2},{1,3},{1,4},{1,5},{2,1},{2,2},{2,3},{2,4},{2,4}};

In[3]:= data1 = Thread[fun[uv,xy]] /. fun -> ({Sequence@@#1,#2[[1]]}&);

In[4]:= data2 = Thread[fun[uv,xy]] /. fun -> ({Sequence@@#1,#2[[2]]}&);


In[5]:= parm1 = FindFit[data1, f1 = a*u+b*v,{a,b},{u,v}]

Out[5]= {a -> 1.04438, b -> 1.02071}


In[6]:= parm2 = FindFit[data2, f2 = c*u*v+d,{c,d},{u,v}]

Out[6]= {c -> 1., d -> 2.5278*^-15}


In[7]:= f[u_,v_] = {f1,f2} /. parm1 /. parm2

Out[7]= {1.04438*u + 1.020718*v, 2.5278*^-15 + 1.*u*v}


hth

V.Astanoff


  • Prev by Date: RE: problem with modules
  • Next by Date: RE: problem with modules
  • Previous by thread: Can FindFit handle two dependent variables?
  • Next by thread: How to adapt a Style Sheet?