Fit a power model to the set of data

1 回表示 (過去 30 日間)
Ro Al
Ro Al 2020 年 12 月 1 日
編集済み: Image Analyst 2020 年 12 月 1 日
I need to fit a power model in the following data below and get its coeffiecient of regression/ (r^2) and predict the lane width at distance 2m:
Distance,m= [2.4 1.5 2.4 1.8 1.8 2.9 1.2 3 1.2]
Lane width,m= [2.9 2.1 2.3 2.1 1.8 2.7 1.5 2.9 1.5]
The model should be in the form of y=constant*x^constant

回答 (2 件)

Abdolkarim Mohammadi
Abdolkarim Mohammadi 2020 年 12 月 1 日
Type cftool in the command window to open Curve Fitting toolbox. Then you can import your data and fit the power function.

Image Analyst
Image Analyst 2020 年 12 月 1 日
編集済み: Image Analyst 2020 年 12 月 1 日
Why do you think this follows a power law?
Distance = [2.4 1.5 2.4 1.8 1.8 2.9 1.2 3 1.2]
LaneWidth = [2.9 2.1 2.3 2.1 1.8 2.7 1.5 2.9 1.5]
plot(Distance, LaneWidth, 'b.-', 'MarkerSize', 20);
grid on;
xlabel('Distance', 'FontSize', 18);
ylabel('LaneWidth', 'FontSize', 18);
For what it's worth, I'm attaching a demo to do a non-linear fit to a power law. You can adapt it as needed.

カテゴリ

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