fit plane to xz axis of data

• To: mathgroup at smc.vnet.net
• Subject: [mg89515] fit plane to xz axis of data
• From: will parr <willpowers69 at hotmail.com>
• Date: Wed, 11 Jun 2008 03:20:22 -0400 (EDT)

```Dear Math Forum,

I am having problems fitting a plane to some data. I am using the following procedure to fit the plane to my data (data is pasted at the bottom of this message):

In[2]:= plane = Fit[data, {1, x, y}, {x, y}]

Out[2]= 3.28723- 0.189001 x - 0.0874557 y

Then the following to display the points and plane:

Show[ListPointPlot3D[data, Boxed -> False, Axes -> True,
AxesEdge -> {{-1, -1}, {-1, -1}, {-1, -1}},
AxesLabel -> {"x", "y", "z"}],
Plot3D[plane, {x, Min[data[[All, 1]]], Max[data[[All, 1]]]}, {y,
Min[data[[All, 2]]], Max[data[[All, 2]]]},
PlotStyle -> Directive[Green, Opacity[0.5]],
Mesh -> None]]

This works fine at fitting the plane in the xy axis, but I want to fit the plane to the xz axis. Does anyone know how this is done?

best wishes,

Will

data = {{7.082985877990723`, 4.599858283996582`,
1.7876174449920654`}, {7.721011638641357`,
2.7678275108337402`, -1.8340442180633545`}, {8.062139511108398`,
4.328474521636963`, 2.9884345531463623`}, {8.354524612426758`,
3.9957642555236816`, 1.285754680633545`}, {8.591523170471191`,
3.669908046722412`,
0.35061490535736084`}, {8.800214767456055`, -5.662844657897949`,
1.5693235397338867`}, {8.999824523925781`, -5.489268779754639`,
1.732263445854187`}, {9.180744171142578`,
3.1141233444213867`, -0.16026635468006134`}, {9.349454879760742`, \
-4.594699859619141`, -0.8548158407211304`}, {9.494897842407227`, \
-5.113749027252197`, 1.776286244392395`}, {9.611098289489746`,
1.4295107126235962`,
4.274338722229004`}, {9.72928237915039`, -0.6715118288993835`,
4.490733623504639`}, {9.834979057312012`, 0.180667445063591`,
4.286239147186279`}, {9.944467544555664`, 1.609142541885376`,
3.596613883972168`}, {10.054197311401367`, -3.8651721477508545`,
2.957470655441284`}, {10.163400650024414`, -2.9216561317443848`,
3.6342270374298096`}, {10.268680572509766`, -3.492720127105713`,
3.0406622886657715`}, {10.373204231262207`, -4.105612754821777`,
1.6333847045898438`}, {10.478713035583496`,
1.2002798318862915`, -1.4899744987487793`}, {10.580570220947266`,
1.7534847259521484`, 0.574606716632843`}, {10.68039321899414`,
1.0706040859222412`, 2.273160457611084`}, {10.776029586791992`,
0.12055287510156631`, 2.861393690109253`}, {10.871712684631348`,
1.344092845916748`,
0.6977629065513611`}, {10.96417236328125`, -1.3614286184310913`, \
-0.9521739482879639`}, {11.057815551757812`,
0.46298766136169434`, -0.8828335404396057`}, \
{11.149628639221191`, -0.25233644247055054`,
2.167344570159912`}, {11.243539810180664`, -0.44928330183029175`, \
-0.641356348991394`}, {11.346000671386719`, -0.28226438164711`, \
-0.1394062638282776`}, {11.46136474609375`, -1.187252163887024`,
0.8916858434677124`}};

```

• Prev by Date: misunderstanding of semicolon
• Next by Date: Some undocumented symbols
• Previous by thread: misunderstanding of semicolon
• Next by thread: Re: fit plane to xz axis of data