I want my function to take arguments that describe a 3D plane and take in data from a 3D table, my function is really wrong and I need help with it.
I would then like the program to output the equation for the plane so it will show in the Plot3D function,
I want in thesame box for the table Datas plot points with residuals going down or up to the plane
The equation i have is to sum the residuals I have this r (i) = z (i) - ax (i) - by (i) - c, where i is the table x y z data, better explained in my function
This function must sum up the residuals, I will show you what I have so far, the program and the table data are attached to this post:
First I get each column of the table data
t1 = Table[tp[[i]], {i, 2, Length[tp]}]
xi = Table[t1[[i]][[1]], {i, 1, Length[t1]}];
ymax = Max[xi];
yi = Table[t1[[i]][[2]], {i, 1, Length[t1]}];
Max[yi];
zi = Table[t1[[i]][[3]], {i, 1, Length[t1]}];
xmax = Max[Round[yi]];
Then the function I have is as follows:
DefineRSS[a_, b_, c_, d_] :=
Block[{output}, output =(ax + by + c);
rss =(sum[(xi) - ax (ji) - by (ki) - c,{xi,imin,imax},{zj,jmin,jmax},{kj,kmin,kmax}]);
output]
This function is supposed to sit in manipulate, the idea is for the user to select the plane they want and find out what the sum of the residuals would be:
Manipulate[
Plot3D[DefineRSS[a, b, c, ?], {x, -10, 10}, {y, -10, 10},
AxesLabel -> {X, Y, Z}], {a, -5, 5}, {b, -5, 5}, {c, -5, 5}]
Show[ListPointPlot3D[t1, PlotStyle -> Red Gray ],
Plot3D[fit, {y, 0, ymax}, {x, 0, xmax}] ]
I havent quite got the RSS formulae right, I understand how it is the sum of yi - yi(hat) Im having trouble breaking maths down into sigma style notation or understanding
Attachments: