Effacer les filtres
Effacer les filtres

Fitting Data into a model

3 vues (au cours des 30 derniers jours)
Hussam Ibrahim
Hussam Ibrahim le 26 Avr 2018
I have some fluorescence recovery data. I want to fit it to a 1-exp(-constant*time) model, then use that model to subtract it from my data values to study remaining oscillations. Can someone help me with this?
I tried looking in the Basic fitting toolbox in Matlab, but couldn't find what I wanted. Best,
  1 commentaire
John D'Errico
John D'Errico le 26 Avr 2018
Modifié(e) : John D'Errico le 26 Avr 2018
Use the curvefitting toolbox. The basic fitting tools that you will find off the plot menus do not really offer much in the way of fitting tools. Or use the optimization toolbox. Or use the stats toolbox. If you have none of those toolboxes then get one of them. Whichever fits your probable usage most. Personally, I would not be without any of them.
I like the curve fitting toolbox because it is so easy to enter your model.

Connectez-vous pour commenter.

Réponses (1)

Star Strider
Star Strider le 26 Avr 2018
I would do this:
fluor_fcn = @(b,t) 1 - exp(b.*t); % Model Function
t = linspace(0, 10, 25); % Create ‘t’
y = fluor_fcn(-1,t) + randn(size(t))*0.25; % Create ‘y’
B0 = 1; % Initial Parameter Estimate
B = fminsearch(@(b) norm(fluor_fcn(b,t) - y), B0); % Estimate Parameters
figure
plot(t, y, 'p')
hold on
plot(t, fluor_fcn(B,t), '-')
hold off
grid
Of course, use your own values for ‘t’ and ‘y’, and use an appropriate value for ‘B0’. These are all core MATLAB functions, so no extra Toolboxes are necessary.

Community Treasure Hunt

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

Start Hunting!

Translated by