How to use regression to find equation of data set?

1 回表示 (過去 30 日間)
Jenifer NG
Jenifer NG 2022 年 11 月 3 日
コメント済み: Jenifer NG 2022 年 11 月 6 日
Dear All,
I would like to ask for some help.
I am trying to find the equation present my data.
But io stuck when use regression method.
could someone help me?
i assume my equation is:
z = a*x^n +b*y+c
Thanks so much!
Han
x = [12 12.5 13 13.5 14
]
x = 1×5
12.0000 12.5000 13.0000 13.5000 14.0000
y = [61 61.5 62 62.5 63
]
y = 1×5
61.0000 61.5000 62.0000 62.5000 63.0000
z = [120 114 103 93 80
124 120 109 97 85
128 121 113 101 88
130 125 116 105 92
134 128 119 109 96
]
z = 5×5
120 114 103 93 80 124 120 109 97 85 128 121 113 101 88 130 125 116 105 92 134 128 119 109 96
surf(x,y,z)

採用された回答

KSSV
KSSV 2022 年 11 月 3 日
x = [12 12.5 13 13.5 14] ;
y = [61 61.5 62 62.5 63] ;
[X,Y] = meshgrid(x,y) ;
Z = [120 114 103 93 80
124 120 109 97 85
128 121 113 101 88
130 125 116 105 92
134 128 119 109 96] ;
x = X(:) ;
y = Y(:) ;
z = Z(:) ;
sf = fit([x, y],z,'poly22')
Linear model Poly22: sf(x,y) = p00 + p10*x + p01*y + p20*x^2 + p11*x*y + p02*y^2 Coefficients (with 95% confidence bounds): p00 = -3160 (-6274, -46.38) p10 = 55.49 (9.233, 101.7) p01 = 90.67 (-8.557, 189.9) p20 = -4.514 (-5.311, -3.717) p11 = 0.68 (0.01303, 1.347) p02 = -0.7429 (-1.54, 0.05432)
plot(sf,[x y],z)
  5 件のコメント
KSSV
KSSV 2022 年 11 月 5 日
x = [12 12.5 13 13.5 14] ;
y = [61 61.5 62 62.5 63] ;
[X,Y] = meshgrid(x,y) ;
Z = [120 114 103 93 80
124 120 109 97 85
128 121 113 101 88
130 125 116 105 92
134 128 119 109 96] ;
x = X(:) ;
y = Y(:) ;
z = Z(:) ;
sf = fit([x, y],z,'poly22')
Linear model Poly22: sf(x,y) = p00 + p10*x + p01*y + p20*x^2 + p11*x*y + p02*y^2 Coefficients (with 95% confidence bounds): p00 = -3160 (-6274, -46.38) p10 = 55.49 (9.233, 101.7) p01 = 90.67 (-8.557, 189.9) p20 = -4.514 (-5.311, -3.717) p11 = 0.68 (0.01303, 1.347) p02 = -0.7429 (-1.54, 0.05432)
zi = sf(x,y) ;
figure
hold on
surf(X,Y,Z)
plot3(x,y,zi,'*b')
view(3)
Jenifer NG
Jenifer NG 2022 年 11 月 6 日
thanks you!
I got it

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by