フィルターのクリア

fit scatter plot to a curve

2 ビュー (過去 30 日間)
Tesla
Tesla 2022 年 5 月 24 日
コメント済み: Tesla 2022 年 5 月 24 日
I want to fint those scatter points to a curve.
I tried using lsline but seems not working, i tried also with polyfit.
here my small code
clc, clear all;
x = [0,0.1, 0.2, 0.3, 0.4, 0.46, 0.55, 0.6];
y =[0, 0.0982, 0.1359, 0.126, 0.0778, 0.0827, 0.063, 0.0599];
% f= polyfit(y,x,7)
% xx = linspace(min(x), max(x));
% %xx = 0:0.1:2.5; %%%%%%%%%%%%%%%%%%%%%%
% v = polyval(f, xx); %%%%%%%%%%%%%%%%%%%
% plot(x,y,'o', xx,v,'-')
plot (x,y)
lsline

採用された回答

Walter Roberson
Walter Roberson 2022 年 5 月 24 日
x = [0,0.1, 0.2, 0.3, 0.4, 0.46, 0.55, 0.6];
y =[0, 0.0982, 0.1359, 0.126, 0.0778, 0.0827, 0.063, 0.0599];
f= polyfit(x,y,7)
xx = linspace(min(x), max(x));
v = polyval(f, xx);
plot(x,y,'o', xx,v,'-')
  1 件のコメント
Tesla
Tesla 2022 年 5 月 24 日
Thank you very much it works now

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by