diff --git a/triangle_analysis.m b/triangle_analysis.m index d20b4e5fa65f4bbd6933972a84721872447805de..5cd064dd2563dbfddce90d6a3d9d2d2b5c66bdf6 100644 --- a/triangle_analysis.m +++ b/triangle_analysis.m @@ -210,12 +210,24 @@ fitList=Map[NonlinearModelFit[#[[2]],Exp[-(t-t0)/tmix]+c,{{tmix,1000},{t0,10000} (* Use fit["BestFitParameters"] to get parameters *) (* Use fit[t] to get fit value *) fitFuncsT=Map[#[t]&,fitList]; +tmixList=Map[tmix/.#["BestFitParameters"]&,fitList]; timeplot1=ListPlot[coarseData,Joined->True,PlotRange->{0*minCount,maxCount},DataRange->{0,measureSkip*maxTime},PlotStyle->Opacity[0.5]]; Show[timeplot1,Plot[fitFuncsT,{t,1,maxTime},PlotRange->All]] +(* Log version of exponential fits *) +fitAverages=Map[c/.#["BestFitParameters"]&,fitList]; +shiftedFitFuncsT=MapIndexed[#1[t]-fitAverages[[#2[[1]]]]&,fitList]; +shiftedCoarseData=MapIndexed[MovingAverage[#1[[2]],1000][[1;;-1;;skipPts]]-fitAverages[[#2[[1]]]]&,selectedData]; + + +(* Plot log version *) +timeplot2=ListLogPlot[shiftedCoarseData[[1;;5]],Joined->True,PlotRange->{0*minCount+0.1,maxCount},DataRange->{0,measureSkip*maxTime},PlotStyle->Opacity[0.5]]; +Show[timeplot2,LogPlot[Evaluate[shiftedFitFuncsT[[1;;5]]],{t,1,maxTime},PlotRange->All,PlotStyle->Dotted]] + + (* ::Subsection:: *) (*Plot success rate over "time"*) diff --git a/triangle_exponent_plots.m b/triangle_exponent_plots.m index a1cb8372738d67426cf0637cd320030854abe744..23440533c6d45c265afb060731a1374913c63a04 100644 --- a/triangle_exponent_plots.m +++ b/triangle_exponent_plots.m @@ -91,10 +91,10 @@ Show[ListPlot[{averagesExponents,mediansExponents},Joined->True,PlotMarkers->Aut (* For visual, shift the tau values slightly left or right to distinguish the two datasets *) tauValues=averagesGrouped[[All,1,1,1,2]]; averagesExponentsErrorBars=Map[{{#[[1]],#[[2]]["BestFitParameters"][[2]]},ErrorBar[#[[2]]["ParameterConfidenceIntervals"][[2]]-#[[2]]["BestFitParameters"][[2]]]}&, -Transpose[{tauValues-0.005,averagesFitsExtra}]]; +Transpose[{tauValues-0.001,averagesFitsExtra}]]; mediansExponentsErrorBars=Map[{{#[[1]],#[[2]]["BestFitParameters"][[2]]},ErrorBar[#[[2]]["ParameterConfidenceIntervals"][[2]]-#[[2]]["BestFitParameters"][[2]]]}&, -Transpose[{tauValues+0.005,mediansFitsExtra}]]; -plot4=Show[ErrorListPlot[{averagesExponentsErrorBars,mediansExponentsErrorBars},Joined->True,PlotMarkers->Automatic,Frame->True,FrameLabel->{"tau","triangle exponent"},PlotRange->{{2,3},{0,1.6}},ImageSize->300],Plot[3/2(3-tau),{tau,2,3},PlotStyle->{Dashed}]] +Transpose[{tauValues+0.001,mediansFitsExtra}]]; +plot2=Show[ErrorListPlot[{averagesExponentsErrorBars,mediansExponentsErrorBars},Joined->True,PlotMarkers->Automatic,Frame->True,FrameLabel->{"tau","triangle exponent"},PlotRange->{{2,3},{0,1.6}},ImageSize->300],Plot[3/2(3-tau),{tau,2,3},PlotStyle->{Dashed}]] Export[NotebookDirectory[]<>"plots/triangle_exponent.pdf",plot2]