public static Chart getMSDLineWithPowerModelChart(Trajectory t, int lagMin,
			int lagMax, double timelag, double a, 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] = 4 * D * Math.pow(i * timelag, a);
		}

		// Create Chart
		Chart chart = QuickChart.getChart("MSD Line", "LAG", "MSD", "MSD",
				xData, yData);
		chart.addSeries("y=4*D*t^alpha", xData, modelData);

		// Show it
		//new SwingWrapper(chart).displayChart();
		return chart;
	}
public static Chart getMSDLineWithPowerModelChart ( Trajectory t , int lagMin , int lagMax , double timelag , double a , 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 ] = 4 * D * Math . pow ( i * timelag , a ) ; } Chart chart = QuickChart . getChart ( "MSD Line" , "LAG" , "MSD" , "MSD" , xData , yData ) ; chart . addSeries ( "y=4*D*t^alpha" , xData , modelData ) ; return chart ; }
Plots the MSD curve with the trajectory t and adds the fitted model for anomalous diffusion above.
@param t
@param lagMin Minimum timelag (e.g. 1,2,3..) lagMin*timelag = elapsed time in seconds
@param lagMax lagMax Maximum timelag (e.g. 1,2,3..) lagMax*timelag = elapsed time in seconds
@param timelag Elapsed time between two frames.
@param a Exponent alpha of power law function
@param D Diffusion coeffcient