Borrar filtros
Borrar filtros

lsqcurvefit help and curve fitting

2 visualizaciones (últimos 30 días)
Daniel Alejandro Diaz
Daniel Alejandro Diaz el 10 de Abr. de 2023
Comentada: Torsten el 11 de Abr. de 2023
Dear Community,
I am trying to fit my mathematical model to the data I was able to retrieve. Currently my graph is showing this:
And followed by this prompt:
Do you know why the system isnt matching the data completely? I applied this to another case and it was able to work but my Dab was 2 orders of magnitude lower
Any help would be greatly appreciated!
-Daniel
  3 comentarios
Daniel Alejandro Diaz
Daniel Alejandro Diaz el 11 de Abr. de 2023
Editada: Torsten el 11 de Abr. de 2023
Hi Torsten,
You are completely right. Sorry about that. Here is the attached data with my code. If there is anything else I could do to help with this please let me know and I will attend to it ASAP! Thank you!
%% Fitting experimental data to mathematical model %%
% Dab is found to be around 8.124E-8 cm^2/s (Source: Preparation & characterization
% of chitosan membrane for the permeation of 5FU - Jen Ming Yang)
clear all
%Calling data from excel
filename = 'Data Sheet.xlsx'; % Call the file we are using
sheet = 'Run 1'; % Call the sheet we are using
xlRange = 'A2:A12'; % Call time values in seconds
x2Range = 'B2:B12'; % Call concentration in mg/mL
t = xlsread(filename, sheet, xlRange); % t = xlsread(filename, sheet, xlRange); % Reads x-axis specified with above variables
c = xlsread(filename,sheet, x2Range); % c = xlsread(filename, sheet, x2Range); % Reads y-axis specified with above variables
figure
plot(t,c,'-')
hold on
x0 = 0.00000000001;
optimoptions(@lsqnonlin,'StepTolerance',1e-12);
Dab = lsqcurvefit(@f, x0, t, c) % fitting Dab to function(@f) defined below
Local minimum possible. lsqcurvefit stopped because the size of the current step is less than the value of the step size tolerance.
Dab = 3.4381e-07
% to data t & c starting at 0 by using x0
% and will be in units (cm^2/s)
t = [t;(6000:1000:50000).'];
plot(t,f(Dab,t),'--')
hold off
grid
title('Release')
%legend('Experimental','Theoretical')
xlabel('Time (sec)')
ylabel('Concentration (mg/mL)')
function Cal = f(Dab,t)
n = 0:250; % Number of sumations
RE = 0.10; % Release Efficieny for Chitosan is 6% so report value might be overestimated
Co = 187.*(RE); % Initial concentration of drug inside patch (mg/cm^3) (11.5 matches data!!!!)
L = 0.11; % Distance from middle of patch to surface (cm)
Vp = 1*1*2*L; % Volume of patch (cm^3)
Vl = 40; % Volume of liquid reservoir (cm^3)
%Belows is the average concentration profile <Ca>
lambdan = (((2.*n+1).*pi)./(2.*L)) ;
sum_parts = (((-1).^n)./(lambdan.^2)) .* exp(-(lambdan.^2).*Dab.*t) .* sin(lambdan.*L) ; %Summation
Cal = ((Co.*Vp)./Vl).*(1-(2./(L.^2)).*sum(sum_parts,2)); %Final Function
end
Also, Here is the expression i am fitting to the data
Torsten
Torsten el 11 de Abr. de 2023
Do you see the reason for your problem in the graphics above ? The end concentration you assume is much too high - it should be similar to the asymptotic value to which your measurement data converge (around 0.032).

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by