Message Boards Message Boards

Final touches, Errors importing a table and showing ListPlot data,

Posted 9 years ago

Just puttting the finishing touches on this program and Im getting the error:

Part specification [[1]] is longer than depth of object. >>

But i dont when I import locally, either way though, the program does not plot the plot points and residuals, I'm having a lot of trouble using import, additionally is there a good GUI input box that will fit in this programs graphics and could take a directory? would it have to be in manipulate?

t = Import[ "http://mejeef.tk//xls//RegressionExample.xls"];

tp = t[[1]];
t1 = Table[tp[[i]], {i, 2, Length[tp]}];
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]}];


Clear[DefineRSS];
DefineRSS[a_?NumericQ, b_?NumericQ, 
  c_?NumericQ] := (rss = Total[(zcol - (a*xcol + b*ycol + c)^2)];
  (a*x) + (b*y) + c)


Manipulate[
 With[{plane = DefineRSS[a, b, c]}, 
  Show[Plot3D[plane, {x, -10, 10}, {y, -10, 10}, 
    AxesLabel -> {X, Y, Z}, PlotLabel -> rss], 
   Graphics3D[{Red, PointSize[Medium], 
     Point[Transpose[{xcol, ycol, zcol}]], 
     Line[Transpose[{{xcol, ycol, zcol}, {xcol, ycol, 
         plane /. Thread[{x, y} -> {xcol, ycol}]}}, {2, 3, 1}]]}], 
   PlotRange -> {{-11, 11}, {-11, 11}, {-50, 50}}]], {a, -5, 
  5}, {b, -5, 5}, {c, -5, 5}]

Also is there a way to make the heading of the 3D image bolder and to lock it in place?

Thank you in advance, im almost finished with my project im so relieved, What could I do with my weak mathematica knowledge now to learn it? you think project ueler.org problems are good to practice mathematica code?

POSTED BY: jethro holcroft
2 Replies

Oh, its not importing again :/

POSTED BY: jethro holcroft
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract