How to use regression to find equation of data set?

1 visualización (últimos 30 días)
Jenifer NG
Jenifer NG el 3 de Nov. de 2022
Comentada: Jenifer NG el 6 de Nov. de 2022
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)

Respuesta aceptada

KSSV
KSSV el 3 de Nov. de 2022
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 comentarios
KSSV
KSSV el 5 de Nov. de 2022
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 el 6 de Nov. de 2022
thanks you!
I got it

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with Curve Fitting Toolbox en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by