Main Content

이 번역 페이지는 최신 내용을 담고 있지 않습니다. 최신 내용을 영문으로 보려면 여기를 클릭하십시오.

곡면 피팅 값 구하기

이 예제에서는 곡면 피팅을 다루는 방법을 보여줍니다.

데이터를 불러와서 다항식 곡면 피팅하기

load franke;
surffit = fit([x,y],z,'poly23','normalize','on')
     Linear model Poly23:
     surffit(x,y) = p00 + p10*x + p01*y + p20*x^2 + p11*x*y + p02*y^2 + p21*x^2*y 
                    + p12*x*y^2 + p03*y^3
       where x is normalized by mean 1982 and std 868.6
       and where y is normalized by mean 0.4972 and std 0.2897
     Coefficients (with 95% confidence bounds):
       p00 =      0.4253  (0.3928, 0.4578)
       p10 =      -0.106  (-0.1322, -0.07974)
       p01 =     -0.4299  (-0.4775, -0.3822)
       p20 =     0.02104  (0.001457, 0.04062)
       p11 =     0.07153  (0.05409, 0.08898)
       p02 =    -0.03084  (-0.05039, -0.01129)
       p21 =     0.02091  (0.001372, 0.04044)
       p12 =     -0.0321  (-0.05164, -0.01255)
       p03 =      0.1216  (0.09929, 0.1439)

출력에는 피팅된 모델 방정식, 피팅된 계수, 피팅된 계수에 대한 신뢰한계가 표시됩니다.

피팅, 데이터, 잔차, 예측한계 플로팅하기

plot(surffit,[x,y],z)

Figure contains an axes object. The axes object contains 2 objects of type surface, line. One or more of the lines displays its values using only markers

잔차 피팅을 플로팅합니다.

plot(surffit,[x,y],z,'Style','Residuals')

Figure contains an axes object. The axes object contains 2 objects of type patch, stem.

피팅에 대한 예측한계를 플로팅합니다.

plot(surffit,[x,y],z,'Style','predfunc')

Figure contains an axes object. The axes object contains 4 objects of type surface, line. One or more of the lines displays its values using only markers

지정된 점에서 피팅 값 구하기

z = fittedmodel(x,y) 형식으로 xy에 대한 값을 지정하여 특정 점에서 피팅을 계산합니다.

surffit(1000,0.5)
ans = 0.5673

여러 점에서 피팅 값 구하기

xi = [500;1000;1200];
yi = [0.7;0.6;0.5];
surffit(xi,yi)
ans = 3×1

    0.3771
    0.4064
    0.5331

해당 값에 대한 예측한계를 구합니다.

[ci, zi] = predint(surffit,[xi,yi])
ci = 3×2

    0.0713    0.6829
    0.1058    0.7069
    0.2333    0.8330

zi = 3×1

    0.3771
    0.4064
    0.5331

모델 방정식 가져오기

피팅 이름을 입력하여 모델 방정식, 피팅된 계수, 피팅된 계수에 대한 신뢰한계를 표시합니다.

surffit
     Linear model Poly23:
     surffit(x,y) = p00 + p10*x + p01*y + p20*x^2 + p11*x*y + p02*y^2 + p21*x^2*y 
                    + p12*x*y^2 + p03*y^3
       where x is normalized by mean 1982 and std 868.6
       and where y is normalized by mean 0.4972 and std 0.2897
     Coefficients (with 95% confidence bounds):
       p00 =      0.4253  (0.3928, 0.4578)
       p10 =      -0.106  (-0.1322, -0.07974)
       p01 =     -0.4299  (-0.4775, -0.3822)
       p20 =     0.02104  (0.001457, 0.04062)
       p11 =     0.07153  (0.05409, 0.08898)
       p02 =    -0.03084  (-0.05039, -0.01129)
       p21 =     0.02091  (0.001372, 0.04044)
       p12 =     -0.0321  (-0.05164, -0.01255)
       p03 =      0.1216  (0.09929, 0.1439)

모델 방정식만 구하려면 formula를 사용하십시오.

formula(surffit)
ans = 
'p00 + p10*x + p01*y + p20*x^2 + p11*x*y + p02*y^2 + p21*x^2*y + p12*x*y^2 + p03*y^3'

계수 이름과 값 가져오기

계수를 이름으로 지정합니다.

p00 = surffit.p00
p00 = 0.4253
p03 = surffit.p03
p03 = 0.1216

모든 계수 이름을 가져옵니다. 피팅 방정식(예: f(x,y) = p00 + p10*x...)을 살펴보며 각 계수에 대한 모델 항을 확인합니다.

coeffnames(surffit)
ans = 9x1 cell
    {'p00'}
    {'p10'}
    {'p01'}
    {'p20'}
    {'p11'}
    {'p02'}
    {'p21'}
    {'p12'}
    {'p03'}

모든 계수 값을 가져옵니다.

coeffvalues(surffit)
ans = 1×9

    0.4253   -0.1060   -0.4299    0.0210    0.0715   -0.0308    0.0209   -0.0321    0.1216

계수에 대한 신뢰한계 가져오기

계수에 대한 신뢰한계를 사용하여 피팅을 계산하고 비교할 수 있습니다. 계수에 대한 신뢰한계는 계수의 정확도를 결정합니다. 서로 멀리 떨어진 한계는 불확실성을 나타냅니다. 선형 계수에 대해 한계가 영점을 교차하는 경우, 이는 해당 계수가 0과 다르다는 사실을 확신할 수 없음을 의미합니다. 일부 모델 항이 0인 계수를 가진다면 이는 피팅에 도움이 되지 않습니다.

confint(surffit)
ans = 2×9

    0.3928   -0.1322   -0.4775    0.0015    0.0541   -0.0504    0.0014   -0.0516    0.0993
    0.4578   -0.0797   -0.3822    0.0406    0.0890   -0.0113    0.0404   -0.0126    0.1439

방법 찾기

피팅에서 사용할 수 있는 모든 방법을 나열합니다.

methods(surffit)
Methods for class sfit:

argnames       category       coeffnames     coeffvalues    confint        dependnames    differentiate  feval          fitoptions     formula        indepnames     islinear       numargs        numcoeffs      plot           predint        probnames      probvalues     quad2d         setoptions     sfit           type           

피팅 방법 사용에 대한 자세한 내용은 sfit 항목을 참조하십시오.

참고 항목

| | |