XY軸上の複数の点に対しての曲線近似
    6 views (last 30 days)
  
       Show older comments
    
等間隔でない点が5点あります。[(x1,y1),(x2,y2)(x3,y3),(x4,y4),(x5,y5)]
この5点に対しての2次曲線Y=Ax^2+Bx+C の曲線を引き、グラフを書きたいです。
p = polyfit(x,y,n) を使用するかと考えたのですが使用してどのように作るか分かりませんでした。
教えて頂けると幸いです。
0 Comments
Answers (1)
  Naoya
    
 on 17 Jan 2021
        p = polyfit(x,y,n)
にあたえる x, y はそれぞれ、x軸と そのx軸に対応するy軸の値をベクトルで与えます。例えば、以下のような形で近似となる 2次式を求めることができますがいかがでしょうか?
X = [x1,x2,x3,x4,x5]
Y = [y1,y2,y3,y4,y5];
p = polyfit(X,Y,2);
xv = linspace(X(1), X(end), 100);
yv = polyval(p, xv);
plot(X,Y,'o', xv, yv,'-')
0 Comments
See Also
Categories
				Find more on スプラインの作成 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!
