Hyperbolic Fitting using multiple data sets from each experiment.
2 次查看(过去 30 天)
显示 更早的评论
I have many x values and correspinding y value data set from a experiment, I wish to model it as y = 1 / (a + b*x^c) o
The x values from each data set is different.
0 个评论
回答(1 个)
chicken vector
2023-4-24
编辑:chicken vector
2023-4-24
data = readmatrix('Model.xlsx');
x = data(:,1);
y = data(:,2);
x = x(~isnan(x));
y = y(~isnan(y));
% Credits @Star Strider
hyprb = @(b,x) 1./(b(1) + b(2).*x.^b(3));
NRCF = @(b) norm(y - hyprb(b,x));
B0 = [1; 1; 1];
B = fminsearch(NRCF, B0);
figure
hold on;
grid on;
plot(x, y, 'pg')
plot(x, hyprb(B,x), '-r')
text(0.7, 0.52, sprintf('y = 1/(%.4f %+.4f x ^{%.4f})', B))
Result:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!