Message Boards Message Boards

GROUPS:

Help fitting data to standard model using LinearModelFit?

Posted 1 month ago
232 Views
|
1 Reply
|
0 Total Likes
|

Posted 1 month ago

Hi Jonathan,

Might be easier to work with Quantity rather than TimeObject.

(* Convert TimeObject to Quantity *)
times = Quantity[MixedMagnitude[#], MixedUnit[{"Minutes", "Seconds"}]] & @@@ timestamps

(* Convert to seconds *)
seconds = UnitConvert[#, "Seconds"] & /@ times

pointList1 = Thread[{seconds, measurements1}];
pointList2 = Thread[{seconds, measurements2}];

DateListPlot[{pointList1, pointList2}, PlotLegends -> {"first run, slot 3", "second run, slot 3"}]

lm2 = LinearModelFit[QuantityMagnitude /@ pointList2, x, x]

Show[DateListPlot[{pointList1, pointList2}, PlotLegends -> {"first run, slot 3", "second run, slot 3"}],
 Plot[lm2[x], {x, 54, 1500}, PlotStyle -> Blue]]

enter image description here

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