Fitting Data into a model

조회 수: 1 (최근 30일)
Hussam Ibrahim
Hussam Ibrahim 2018년 4월 26일
답변: Star Strider 2018년 4월 26일
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
John D'Errico
John D'Errico 2018년 4월 26일
편집: John D'Errico 2018년 4월 26일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Star Strider
Star Strider 2018년 4월 26일
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.

카테고리

Help CenterFile Exchange에서 Curve Fitting Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by