Hyperbolic Fitting using multiple data sets from each experiment.

2 ビュー (過去 30 日間)
Mir
Mir 2023 年 4 月 24 日
編集済み: chicken vector 2023 年 4 月 24 日
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.

回答 (1 件)

chicken vector
chicken vector 2023 年 4 月 24 日
編集済み: chicken vector 2023 年 4 月 24 日
Please try to use the forum next time, as your answer was just a simple search away.
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:

カテゴリ

Help Center および File ExchangeLinear and Nonlinear Regression についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by