how to fit several curves into one curve

I have six dataset ,which are (x1,y1), (x1,y2), (x1,y3), (x1,y4), (x1,y5), (x1,y6), an the expected fitting is as:
AA = w1 * y1 + w2 * y2 + w3 * y3 + w4 * y4 + w5 * y5 ;
w1, w2,w3,w4,w5 are weight factor
delta = (AA / max(AA) - y6)^2 == 0;
the data is attached .
could anyone share his ideal with me to how to solve the problem? thanks a lot!
the y1~y5 dataset plot are following:
the y6 data plot is as following

 Respuesta aceptada

chen xl
chen xl el 27 de Abr. de 2022

0 votos

just now, I find the function "lsqnonneg", although the residual is about big, it sounds working.

6 comentarios

Alex Sha
Alex Sha el 27 de Abr. de 2022
you didn't use x1 data anywhere, is it right?
if right, the result will be:
w1 0.513266121252864
w2 0.331937542610903
w3 0.124057751591303
w4 0.0237889810732275
w5 0.00694960347170328
chen xl
chen xl el 27 de Abr. de 2022
Alex , yes, the x data is not be used.
i am sorry that i have no answer at hand, the fitted result need to be confirmed by further calculation.
however,the result seems better than that produced by lsqnonneg, could you please share the code?
Alex Sha
Alex Sha el 28 de Abr. de 2022
You don't give this data yet.
chen xl
chen xl el 28 de Abr. de 2022
the fitting is one of the steps which are used to determine a laser intensity distribution. there are two intenstiy profiles from the spec, and Target y( or y6) is one of the two. this is why I have no answer at hand.
if just taking the y axis profile into account, the data needed are all in y1~y6 dataset, if taking x and y axis profile into account, then there need some other data.
chen xl
chen xl el 28 de Abr. de 2022
all of the dataset is attached.
the expected fitting is as:
AA = w1 * x1 + w2 * x2 + w3 * x3 + w4 * x4 + w5 * x5 + w6 * x6 + w7 * x7 + w8 * x8 ;
BB = w1 * y1 + w2 * y2 + w3 * y3 + w4 * y4 + w5 * y5 + w6 * y6 + w7 * y7 + w8 * y8 ;
w1, w2,w3,w4,w5 ,w6,w7,w8 are weight factor
delta = ( AA / max(AA) - x9 / max(x9) )^2 + (BB / max(BB) - y9 / max(y9) )^2 == 0;

Iniciar sesión para comentar.

Más respuestas (1)

chen xl
chen xl el 28 de Abr. de 2022

0 votos

just now, make use of the function fminunc, the code is as following:
options = optimoptions(@fminunc,'Diagnostics','on','Display','iter','FunValCheck','on','MaxIterations',1e10,'OptimalityTolerance',1e-12,'PlotFcn','optimplotx','StepTolerance',1e-12);
fun = @(W) sum((sum(x1.*W,2)/max(sum(x1.*W,2)) - xxv/max(xxv)).^2) + sum((sum(y1.*W,2)/max(sum(y1.*W,2)) - yyp/max(yyp)).^2);
W0 =[10000 10000 10000 10000 10000 10000 10000 10000];
[ww ab] = fminunc(fun,W0,options);
get an answer, as following:
ww = [ 25487.4, 17618.4, 10475.0, 4749.7, 19207.7, 8030.61, 1596.92, 330.329]
ab = 7.5882
although the residual is about 8, the x fitting degree of the coincidence is too worse than that for y fitting.
it is appreciated for any suggestion from anyone on how to improve the x fitting degree.

2 comentarios

Alex Sha
Alex Sha el 28 de Abr. de 2022
Hi, if your model and data are all correct, the results you get should be the best solution.
Even if you just think about x9 (Ignore y9), the result is just as bad.
chen xl
chen xl el 28 de Abr. de 2022
Ok, thank you for your kindly confirmation, Alex Sha. tomorrow, i try to do some adjustment to the model, and let see wether any improve will happen

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with Curve Fitting Toolbox en Centro de ayuda y File Exchange.

Preguntada:

el 27 de Abr. de 2022

Comentada:

el 28 de Abr. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by