Fitting Data into a model
1 回表示 (過去 30 日間)
古いコメントを表示
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
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
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Curve Fitting Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!