Plot of an curve and its equation

6 ビュー (過去 30 日間)
OLuxanna
OLuxanna 2022 年 11 月 5 日
コメント済み: OLuxanna 2022 年 11 月 5 日
Hello;
I'm trying to get an equation of the plot and before trying to get this I got this plot to see if I can catch it truly and it does.
And here what I ve done till now;
x = 0 : 0.1 : 0.9;
y = [0.584459303
0.496427561
0.351841147
0.269416786
-0.080568348
0.354476019
0.155290021
0.755090485
0.612397011
0.505868478];
a=polyfit(x,y,9);
b=polyval(a,x);
plot(x,y,'ro',x,b)
And What I would like to have is the equation of this plot but once I tried to write the equation with the values from polyfit output I got a plot something completely different. May someone please help me? Thank you so much in advance..
x = 0 : 0.1 : 0.9;
y = [0.584459303
0.496427561
0.351841147
0.269416786
-0.080568348
0.354476019
0.155290021
0.755090485
0.612397011
0.505868478];
c= [214387.3975 -859079.8412 1444444.664 -1323346.187 717335.5313 -233431.4118 44018.3122 -4332.146236 165.7218241 0.584459303];
vel = c.*x';
plot(x,vel,'b','LineWidth',2)

採用された回答

VBBV
VBBV 2022 年 11 月 5 日
編集済み: VBBV 2022 年 11 月 5 日
x = 0 : 0.1 : 0.9;
y = [0.584459303
0.496427561
0.351841147
0.269416786
-0.080568348
0.354476019
0.155290021
0.755090485
0.612397011
0.505868478];
a=polyfit(x,y,9)
a = 1×10
1.0e+06 * 0.2144 -0.8591 1.4444 -1.3233 0.7173 -0.2334 0.0440 -0.0043 0.0002 0.0000
b=polyval(a,x)
b = 1×10
0.5845 0.4964 0.3518 0.2694 -0.0806 0.3545 0.1553 0.7551 0.6124 0.5059
plot(x,y,'ro',x,b)
x = 0 : 0.1 : 0.9;
y = [0.584459303
0.496427561
0.351841147
0.269416786
-0.080568348
0.354476019
0.155290021
0.755090485
0.612397011
0.505868478];
c= [214387.3975 -859079.8412 1444444.664 -1323346.187 717335.5313 -233431.4118 44018.3122 -4332.146236 165.7218241 0.584459303];
vel = max(b.*x')
vel = 1×10
0.5260 0.4468 0.3167 0.2425 0 0.3190 0.1398 0.6796 0.5512 0.4553
plot(x,vel,'b-','LineWidth',2)
  2 件のコメント
VBBV
VBBV 2022 年 11 月 5 日
use pol2sym to get equation for the plot
OLuxanna
OLuxanna 2022 年 11 月 5 日
thank you so much Sir for your help. It means a lot.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by