fitting 3 sets of data simultaneously using "lsqcurvefit"

1 visualización (últimos 30 días)
Sara
Sara el 18 de Mayo de 2022
Comentada: Torsten el 19 de Mayo de 2022
I have a set of data in triplicates (attached). I want to fit the exponential part of these 3 sets simultaneously using "lsqcurvefit" and get one x(1) and x(2). I have included "t" and "or" data in the attached file and here is my function:
function y=or(x,t)
y=((0.282*x(2))-0.24)*x(1)*exp((x(2)-0.24)*t)
I managed to fit each data set individually and average x(1) and x(2) and calculte the STdev but if I could fit 3 sets simultenausly using "lsqcurvefit" would be better.
I would be grateful if you kindly help me.

Respuestas (2)

Torsten
Torsten el 18 de Mayo de 2022
Define
T = [t1;t2;t3]
and
OR = [or1;or2;o3]
and treat
[T,OR]
just like you treated
[t1;or1],[t2;or2],[t3;or3]
.
What's the problem ?
  9 comentarios
Sara
Sara el 19 de Mayo de 2022
column, it worked but now gives error on
Y1 = Y(1:numel(t(trangemin:rangemax)));
Torsten
Torsten el 19 de Mayo de 2022
Editada: Torsten el 19 de Mayo de 2022
Y is a numel(t(tangemin:rangemax)) x 3 - matrix.
So
Y1 = Y(:,1)
Y2 = Y(:,2)
Y3 = Y(:,3)
guessing you used the code I submitted.

Iniciar sesión para comentar.


Sara
Sara el 19 de Mayo de 2022
ok, sorry many comments so was confused:(
I think this is based on your comment:
rangemin = 173;
rangemax = 212;
xprime(1)=100;
xprime(2)=7;
TDATA = [t(rangemin:rangemax);t(rangemin:rangemax);t(rangemin:rangemax)];
ORDATA = [ordata(rangemin:rangemax,1);ordata(rangemin:rangemax,2);ordata(rangemin:rangemax,3)];
x = lsqcurvefit(@or,xprime,TDATA,ORDATA);
Y = or(x,TDATA);
Y = reshape(Y,numel(t(tangemin:rangemax)),3);
function y=or(x,t)
y=((0.282*x(2))-0.24)*x(1)*exp((x(2)-0.24)*t);
end
but still gives error on Y = reshape(Y,numel(t(tangemin:rangemax)),3);
  3 comentarios
Sara
Sara el 19 de Mayo de 2022
these seem the same?
Torsten
Torsten el 19 de Mayo de 2022
rangemin vs. tangemin ?

Iniciar sesión para comentar.

Categorías

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

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by