Connecting two Graphs to Create a shape
조회 수: 2 (최근 30일)
이전 댓글 표시
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])
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/201609/image.jpeg)
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!