Matlab, how to create non linear curve from random data?

4 ビュー (過去 30 日間)
uncung fgv
uncung fgv 2012 年 4 月 22 日
example i have data
x=linspace(4,6,7) %data x from 4 until 6 with 7 elements
y=linspace(8,17,7)
i will create hiperbolik data or non linear randomly in matlab

回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 4 月 22 日
curvedegree = 2; %set as desired
coeffs = polyfit(x, y, curvedegree);
plot(x, polyval(coeffs, x)); %plot fitted y
  2 件のコメント
uncung fgv
uncung fgv 2012 年 4 月 23 日
why the plot still liniear?
my data:
>> x=linspace(6.502,6.9,5)
>> y=linspace(63.5,75.39,5)
still linear?
Jan
Jan 2012 年 4 月 23 日
Because you fit a parabola to a line.
Where are the random data you are talking of in the subject line?
What about: y = rand(size(x))?

サインインしてコメントする。

カテゴリ

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