Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
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

Risposte (1)

Walter Roberson
Walter Roberson il 22 Apr 2012
curvedegree = 2; %set as desired
coeffs = polyfit(x, y, curvedegree);
plot(x, polyval(coeffs, x)); %plot fitted y
  2 Commenti
uncung fgv
uncung fgv il 23 Apr 2012
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 il 23 Apr 2012
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))?

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by