My function "DefineRss[]" takes in three arguments and outputs a plane value.
It sits in the first argument of the function plot3D and that in turn sits in the manipulate function
The function also uses the arguments with an algorithm to sum up the distance between each plot point on a 3d table and the newly created plane (3d table data set up at the begining of the program and split into three rows(zxy)) .
the variable rss is supposed to be initialized each time a slider value is changed.
The effect I am trying to get the program to show is to have the rss change before your eyes as the user slides sliders up and down tilting the plane.
The code appears to work but the variable rss remains the same, the output is always the sum of the values and does not change as sliders are changed at all, infact it jsut outputs the sum.
(*Extract table from directory and initialise t1 appropriatley*)
t = Import[
"c:\\Users\\Sony \
Viao\\OneDrive\\Documents\\SumOfSquares\\RegressionExample.xls",
"xls"];
tp = t[[1]];
t1 = Table[tp[[i]], {i, 2, Length[tp]}];
(* xcol, ycol and zcol are the three tables belonging to t1*)
xcol = Table[t1[[i]][[1]], {i, 1, Length[t1]}];
ycol = Table[t1[[i]][[2]], {i, 1, Length[t1]}];
zcol = Table[t1[[i]][[3]], {i, 1, Length[t1]}];
(* rss is initialised to none for now, it should be updated \
dynamically in the manipulate function*)
rss = none;
(* This function returns the equation for a plane and sums up the \
residuals between the plot points and the plane and initialises the \
variable rss*)
DefineRSS[a_, b_, c_] := Block[{output}, output = ((a*x) + (b*y) + c);
rss = ((Sum[
zcol[i] - (a*xcol[i] - b*ycol[i] - c), {i, 1, Length[t1]}])^2);
output]
(*Manipulate allows the function Definerss to both take arguments for \
a plane and sum up the rss variable*)
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}]
(*outputs rss*)
rss
rss
is neither of these. It is outside of the Manipulate scope. If you had a minimal example with the import, one can better show you how, but I can't run your code. $\endgroup$