Scale one scattered dataset to fit another scattered dataset

25 views (last 30 days)
Vahid Askarpour
Vahid Askarpour on 18 Nov 2018
Commented: dpb on 19 Nov 2018
I have two datasets of scattered points. Dataset 1 is defined by (x,y) where x and y are column vectors. Dataset 2 is defined by (z,t) where z and t are column vectors. The four column vectors are of the same size. I would like to scale dataset 1 by a factor (which I do not know) such that the scaled result is the best fit to dataset 2. I do not have a function that defines either datasets so I cannot use lsqcurvefit because I do not have the function "fun".
Is it possible to do the above with Matlab?

Accepted Answer

dpb on 19 Nov 2018
Sure, your "equation" to minimize in least-squares sense is D1(x,y)-k*D2(t,z)
function sse=sseval(k,D1,D2)
and use that as the functional for fminsearch. It expects a function of only the one vector, x, of unknown coeffiecients so define an anonymous function that incorporates the data in it --
fun = @(x) sseval(x,D1,D2);
the values of D1, D2 in the workspace at the time of the definition of fun are embedded into the function definition itself automagically.
x0=1; % starting guess; perhaps the rms ratio of the two would be better if far from 1
  1 Comment
dpb on 19 Nov 2018
...moved to comment... dpb
Thanks dpb. This is exactly what I was looking for.

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 19 Nov 2018
To align/match one scattered set of points to another, you should search for "Point Matching Algorithms"
It's not a trivial problem. It has been researched a lot in the astronomy community. One famous algorithm is the Groth algorithm and has been used to match things like star patterns from the Hubble Space Telescope to identifying whale sharks from their spot patterns.
  1 Comment
dpb on 19 Nov 2018
Trudat, IA, but this appears to be simply a scaling problem as OP defined it, however.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!