How to Fit a line to scatter data on scatter plot?
2 ビュー (過去 30 日間)
古いコメントを表示
I have 3 variables speed, dp,eff and I used the following code to 3d scatter plot the data. The scatter plot is attached. My question is how to find the best fit line for the scatter data on scatter plot. I tried curve fitting tool box but not working great. Help me find out the solution. i.e to find out the best fit line( eqn) and draw that line of scatter plot.
Thank you
load TEAVG_0Dafterconversion.mat
scatter3(speed,dp,eff)
xlabel('Speed')
ylabel('Dp')
zlabel('Eff')
0 件のコメント
回答 (1 件)
Alex Sha
2020 年 9 月 17 日
Hi, Chetan, if you don't mind the length of the fitting equation, refer to follow:
x1=Speed, x2=Dp, y=Eff
y = b0+b1*x1+b2*x1^2+b3*x2+b4*x2^2+b5*(exp(-sqr(x1/100)))+b6*(exp(-sqr(x1/100)))^2+b7*(exp(-sqr(x2/1.4)))+b8*(exp(-sqr(x2/1.4)))^2+b9*x1*x2*(exp(-sqr(x1/100)))+b10*x1*x2*(exp(-sqr(x2/1.4)))^2+b11*x1*x2^2*(exp(-sqr(x2/1.4)))+b12*x1*(exp(-sqr(x1/100)))*(exp(-sqr(x2/1.4)))^2+b13*x1^2*x2*(exp(-sqr(x1/100)))+b14*x1^2*x2*(exp(-sqr(x2/1.4)))^2+b15*x1^2*x2^2*(exp(-sqr(x2/1.4)))+b16*x1^2*(exp(-sqr(x1/100)))*(exp(-sqr(x2/1.4)))^2+b17*x2*(exp(-sqr(x1/100)))*(exp(-sqr(x2/1.4)))+b18*x2*(exp(-sqr(x1/100)))^2*(exp(-sqr(x2/1.4)))^2+b19*x2^2*(exp(-sqr(x1/100)))^2*(exp(-sqr(x2/1.4)))+b20*x1*x2*(exp(-sqr(x1/100)))*(exp(-sqr(x2/1.4)))^2+b21*x1*x2^2*(exp(-sqr(x1/100)))*(exp(-sqr(x2/1.4)))+b22*x1*x2^2*(exp(-sqr(x1/100)))^2*(exp(-sqr(x2/1.4)))^2+b23*x1^2*x2*(exp(-sqr(x1/100)))^2*(exp(-sqr(x2/1.4)))+b24*x1^2*x2^2*(exp(-sqr(x1/100)))*(exp(-sqr(x2/1.4)))^2
Sum of Squared Residual: 0.0118621810316654
Correlation Coef. (R): 0.962793830997943
R-Square: 0.926971961007696
Parameter Best Estimate
---------- -------------
b0 15.310755982188
b1 -0.132958264716742
b2 -0.00156128206992743
b3 10.4211565559291
b4 4.65796095967851
b5 -48.3481150500531
b6 -22.8688433790466
b7 36.3660070659581
b8 19.7901689881374
b9 0.059559167138516
b10 0.387826626201331
b11 -0.0133030524719128
b12 0.107006174136916
b13 -0.00233928422236141
b14 -0.00258023255196725
b15 0.000880324623195984
b16 -0.00696504324693559
b17 -19.2013564945072
b18 8.53997897435642
b19 34.4260175482625
b20 -0.410840827168776
b21 -0.0126076476622779
b22 0.0759466046214045
b23 0.00332686217055514
b24 -0.000562931147662027
3 件のコメント
Alex Sha
2020 年 9 月 17 日
Hi, the fitting function is in the form of y = f(x1,x2)
where x1=Speed, x2=Dp, y=Eff
It is same as you wanted: Eff = f(Speed, Dp)
Of course, the function is very long, although the r-square reach 0.926971961007696
参考
カテゴリ
Help Center および File Exchange で Linear and Nonlinear Regression についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!