How can I fit a sideways polynomial?

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)

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

Products

Release

R2021b

Asked:

on 17 Apr 2022

Answered:

on 17 Apr 2022

Community Treasure Hunt

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

Start Hunting!