Connecting two Graphs to Create a shape

1 view (last 30 days)
Austen Thomas
Austen Thomas on 26 Jan 2019
I am trying to create a specfic shape with the equations shown. The lower parabola needs to be in place of the upper parabola. I tried using if and else if statments but i could not get it to work out. The main issue is that the smaller blue parabola(blue) is plotted (x,y) while the lower parabola(yellow) is plotted *(y,x). I do not know if there is a way to translate the lower parabola to the position of the upper parabola's (red) starting coordinate.
I would appreciate any input
Thank You
Ln = 2.679;
Rt = sqrt(1/(3*pi));
Re = sqrt(14) * sqrt(1/(3*pi));
Nt = 0.056;
Na = 0.339;
k = Rt;
a = (Na-Rt)/(Nt)^2;
a2 = (Re-Na) / (Ln -Nt)^2;
x = linspace(0,Nt,100);
y = a*x.^2+k;
p = polyfit(x,y,10);
x1 = linspace(0, Nt);
y1 = polyval(p,x1);
x2 = linspace(Nt,Ln,100);
y2 = a2 * (x2 - Nt).^2 + Na;
p2 = polyfit(x,y,10);
x3 = linspace(Nt, Ln);
y3 = polyval(p,x3);
plot(x1, y1)
hold on
plot(x3, y3)
hold on
plot(y3, x3)
xlim ([0 1])
ylim ([0 2])

Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!