フィルターのクリア

Plotting best fit line

2 ビュー (過去 30 日間)
Ann
Ann 2021 年 1 月 4 日
コメント済み: Ann 2021 年 1 月 4 日
Hi everyone,
This is my coding and the figure below is the result. My data are all in excel file but now I don't know how to plot the fit slope.
Can anyone advice me? Thanks in advanced.
S4=xlsread('02-Feb-all.xlsx','N:N');
CStdev=xlsread('02-Feb-all.xlsx','P:P');
%_______________Read data_______________%
x=S4;
y=CStdev;
%______________________________%
figure%>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FIGURE starts
scatter(x,y);
title('February 2014');
%datetick('x', 'HH');
xlabel('Ampilitude scintillation (S4)');
ylabel('Sigma-code-carrier Divergence (meters)');
hold all
%_______________PRNall_______________%

採用された回答

KSSV
KSSV 2021 年 1 月 4 日
Read about polyfit. If (x,y) are your data points.
p = polyfit(x,y,1) ;
yi = polyval(p,x) ;
scatter(x,y);
hold on
plot(x,yi,'r')
  1 件のコメント
Ann
Ann 2021 年 1 月 4 日
Oh My God! Thank you, man! It works!!!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by