add contraints on parameters defined in function

2 visualizaciones (últimos 30 días)
Giru Mishra
Giru Mishra el 19 de En. de 2018
Comentada: Matt J el 20 de En. de 2018
I have a function:
y =x.^a + z.^b
For which I wrote a separate function as I neet to fit it over my data. But I want to add constraint: a>b. How will I do that? Please help me with it. Thanks
  5 comentarios
Torsten
Torsten el 19 de En. de 2018
Use "lsqcurvefit" together with the model function y=Const*(x^(c1+c2)+z^c1) and include the bound constraint c2>0.
Once lsqcurvefit has determined c1 and c2, a=c1+c2 and b=c1 in your original model.
Best wishes
Torsten.
Giru Mishra
Giru Mishra el 19 de En. de 2018
any other way?

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 19 de En. de 2018
if a > b
y = x.^a + z.^b;
else
y = zeros(size(x));
end
  4 comentarios
Giru Mishra
Giru Mishra el 20 de En. de 2018
Thanks Walter and Torsten... It was really very helpful..
Matt J
Matt J el 20 de En. de 2018
@Giru,
You should Accept-click the answer if it helped you.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with Curve Fitting Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by