How can i apply a exponential model on a matrix?

2 views (last 30 days)
Hello everyone,
I have some problems with a code i just made.
I create the following code to calculate a flow with a exponetial model. For one line of data, it works.
F =@(x,C)(x(1)-((x(1)-x(2))*exp(x(3)*t)));
x0=[max(C) C(1,1) 0.01];
x= lsqcurvefit(F,x0,t,C(1,:));
fluxexp=(x(1)-x(2))*x(3)
My problem comes when i try to transpose the code for a matrix of data ( several lines of data), it doesn't work but i don't know why.
for i= 1:length (Indeximp)-2
F = @(x,C)(ximp(1)-((ximp(1)-ximp(2))*exp(ximp(3)*t)));
x0=[max(C(i)) C(i,1) 0.0004];
ximp(i)= lsqcurvefit(F,x0,t,C(i,:));
fluxexp(i)=(ximp(i,1)-ximp(i,2))*ximp(i,3); end
If somebody can help me, it could be great.
Thank you

Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!