Message Boards Message Boards

0
|
2711 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

Help fitting data to standard model using LinearModelFit?

Posted 2 years ago
Posted 2 years 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

POSTED BY: Rohit Namjoshi
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