Login  Register

Fourier fitting

Posted by JAMES, gregory (SANDWELL AND WEST BIRMINGHAM HOSPITALS NHS TRUST) on May 01, 2018; 9:22pm
URL: http://imagej.273.s1.nabble.com/Fourier-fitting-tp5020599.html

Hello ImageJ community,

I am a familiar user of the curve fitting feature but I am struggling with a problem...

I want to perform a Fourier fit with 3 harmonics. The code I'm using is therefore:

FourierFit = "y = a + b*cos("+2*PI/24+" * x + c) + d*cos("+4*PI/24+" * x + e) + f*cos("+6*PI/24+" * x + g)";
Fit.doFit(FourierFit, Xarray, Yarray);
Fit.plot();

There are 24 elements in my X and Y arrays. For whatever reason, ImageJ takes issue with the coefficient 'g' saying that it is an undefined variable. When I strip out the 3rd harmonic the code works fine so this is really puzzling me.

Does anyone know what's going on here?

Alternatively, can anyone see an easier way of performing a Fourier fit?

Many thanks,

Greg.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html