public static Chart getMSDLineWithConfinedModelChart ( Trajectory t , int lagMin , int lagMax , double timelag , double a , double b , double c , double d ) { double [ ] xData = new double [ lagMax - lagMin + 1 ] ; double [ ] yData = new double [ lagMax - lagMin + 1 ] ; double [ ] modelData = new double [ lagMax - lagMin + 1 ] ; MeanSquaredDisplacmentFeature msdeval = new MeanSquaredDisplacmentFeature ( t , lagMin ) ; msdeval . setTrajectory ( t ) ; msdeval . setTimelag ( lagMin ) ; for ( int i = lagMin ; i < lagMax + 1 ; i ++ ) { msdeval . setTimelag ( i ) ; double msdhelp = msdeval . evaluate ( ) [ 0 ] ; xData [ i - lagMin ] = i ; yData [ i - lagMin ] = msdhelp ; modelData [ i - lagMin ] = a * ( 1 - b * Math . exp ( ( - 4 * d ) * ( ( i * timelag ) / a ) * c ) ) ; } // Create Chart Chart chart = QuickChart . getChart ( "MSD Line" , "LAG" , "MSD" , "MSD" , xData , yData ) ; if ( Math . abs ( 1 - b ) < 0.00001 && Math . abs ( 1 - a ) < 0.00001 ) { chart . addSeries ( "y=a*(1-exp(-4*D*t/a))" , xData , modelData ) ; } else { chart . addSeries ( "y=a*(1-b*exp(-4*c*D*t/a))" , xData , modelData ) ; } // Show it //new SwingWrapper(chart).displayChart(); return chart ; }
Plots the MSD curve with the trajectory t and adds the fitted model for confined diffusion above .