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 CenterFile Exchange에서 Get 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