how to create curve non linear

2 次查看(过去 30 天)
uncung fgv
uncung fgv 2012-3-26
i want to perform curve at range:
y= from 7 to 9
x= from 2.5 to 3.0
the curve is not linear.

回答(1 个)

Kye Taylor
Kye Taylor 2012-3-26
Not sure I entirely understand your question, but if you're trying to create a nonlinear curve that passes through the two points (2.5,7) and (3,9), you can create a piecewise linear function:
7 if x<2.75
f(x) =
9 if x>=2.75
Or, if you need continuity and differentiability, you can use the equation of a parabola
y(x) = a*x^2+b*x + c
Substituting x = 2.5, y = 7 yields
7 = 6.25*a + 2.5*b + c
Similarly, substituting x = 3, y = 9 yields
9 = 9*a + 3*b + c
This underdetermined system (with unknowns a,b, and c) is consistent and therefore has infintely many solutions. If c = free parameter (t), then a family of parabolas that pass through (2.5,7) and (3,9) is given by
y(x) = (2/15*t + 2/5)*x^2
+ (-11/15*t + 9/5)*x
+ t
For example, if t = 0,
y(x) = 2/5*x^2 + 9/5*x
is a nonlinear curve through the points (2.5,7),(3,9);

类别

Help CenterFile Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by