How can I fit a sideways polynomial?

2 views (last 30 days)
Allan Jin
Allan Jin on 17 Apr 2022
Answered: Star Strider on 17 Apr 2022
How can I get a curve of best fit for a sideways curve? Using the basic fitting or curve fitter gives me a cubic like this. How can I make it so it is an equation along the y axis rather than x?

Answers (1)

Star Strider
Star Strider on 17 Apr 2022
Reverse the usual ‘x’ and ‘y’ assignments for the parabola —
y1 = linspace(-0.6, 0.6);
x1 = y1.^2 + 0.08;
x2 = linspace(0.06, 0.24);
y2 = polyval([194.9 -45.88 2.878 0.008198], x2);
figure
plot(x1, y1)
hold on
plot(x2, y2)
hold off
grid
axis([0.05 0.24 -0.6 0.8])
.

Categories

Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!