Fitting sum of exponential function with experiment data

16 visualizzazioni (ultimi 30 giorni)
I am trying to fit my experimental data with unipore diffusion model, which is a summation of exponential functions as given below.
unipore.JPG
t is the time, De is the diffusion coefficient that I need to find from the experimental data as a fitting parameter. Vt/V can be considered as y variable, which is directly measured from the experiment.
Could you help me to code this to obtain the De?
The experimental data sheet is attached.
Thank you.

Risposte (2)

Sayyed Ahmad
Sayyed Ahmad il 4 Giu 2019
you have to simplified your model to
y=1-c1exp(-c2*x*t)
y ist your Vt/V_inf
c1 represent all other parameter outside your exp() function
c2 represent all parameters inside exp funtion
t is the time
and x would be your De
now you can use the polyfit to find out your De value
for example:
x=1:10;
y=1-exp(-0.1*x); % 0.1 in your case would be is c2*De;
plot(x,y);
p=polyfit(x,-1*log(1-y),1); % p(1) would be c2*De and p(2) would be close to zero and you can ignore this
%De=p(1)/c2;

Arturo Gonzalez
Arturo Gonzalez il 8 Set 2020
Per this answer, you can do it with the following matlab code
clear all;
clc;
% get data
dx = 0.001;
x = (dx:dx:1.5)';
y = -1 + 5*exp(0.5*x) + 4*exp(-3*x) + 2*exp(-2*x);
% calculate n integrals of y and n-1 powers of x
n = 3;
iy = zeros(length(x), n);
xp = zeros(length(x), n+1);
iy(:,1) = cumtrapz(x, y);
xp(:,1) = x;
for ii=2:1:n
iy(:, ii) = cumtrapz(x, iy(:, ii-1));
xp(:, ii) = xp(:, ii-1) .* x;
end
xp(:, n+1) = ones(size(x));
% get exponentials lambdas
Y = [iy, xp];
A = pinv(Y)*y;
Ahat = [A(1:n)'; [eye(n-1), zeros(n-1, 1)]];
lambdas = eig(Ahat);
lambdas
% get exponentials multipliers
X = [ones(size(x)), exp(lambdas'.*x)];
P = pinv(X)*y;
P
% show estimate
y_est = X*P;
figure();
plot(x, y); hold on;
plot(x, y_est, 'r--');

Categorie

Scopri di più su Signal Generation and Preprocessing in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by