School of Mechanical Engineering Pusan National University dongwoonkim@pusan.ac.kr
Review 무명함수 >> fun = @(x,y) x^2 + y^2; % ff xx, yy = xx 2 + yy 2 >> fun(3,4) >> ans = 25 시작 x=x+1 If문 >> if a == b >> c=d; >> end 만약 a=b 라면, c=d로계산하시오 for문 >> for i = 1:5 >> x(i+1)=x(i)+1; >> end 순서도와동일 i=5 출력
Review nlinfit >> fun = @(p,x) I(1)*exp(-p*x); ff tt = II 0 ee μμtt >> t = [0:2:10]; >> I = [0.9726 0.8001 0.6582 0.5415 0.4455 0.3665]; >> b0 = 1; >> mu = nlinfit(t,i,fun,b0); >> figure,plot(t,i, ob ); hold on; >> plot(t,fun(mu,t), r );
Bisection 추정된근의값 x r = x l + x 2 u
Bisection 다음의방법들을사용하여 ff xx = ee xx xx 의근을구하고, 참백분율상대오차를하나의그래프에함께그려비교하시오. 반복횟수에따른오차의특성을살피고, 각방법들간의차이점에대해논하시오. 참값으로 0.56714329 를사용. iteration 함수및초기치설정 xx tttttttt = 0.56714329 ff xx = ee xx xx xx ll = 0, xx uu = 1 yy ll = ff(xx ll ), yy uu = ff(xx uu ) xxxx ii = xxxx ii + xxxx ii 2 yyyy ii = ff(xxxx ii ) 만약 yyyy ii yyyy ii < 0 이면, xxxx ii+1 = xxxx ii 만약 yyyy ii yyyy ii > 0 이면, xxxx ii+1 = xxxx ii 최종결과 xxxx eeeeee, eeee eeeeee 획득 xxxx ii+1 = xxxx ii xxxx ii+1 = xxxx ii eeee ii = 100 xx tttttttt xxxx ii xx tttttttt
Bisection coding
False position 다음의방법들을사용하여 ff xx = ee xx xx 의근을구하고, 참백분율상대오차를하나의그래프에함께그려비교하시오. 반복횟수에따른오차의특성을살피고, 각방법들간의차이점에대해논하시오. 참값으로 0.56714329 를사용. iteration 함수및초기치설정 xx tttttttt = 0.56714329 ff xx = ee xx xx xx ll = 0, xx uu = 1 yy ll = ff(xx ll ), yy uu = ff(xx uu ) xxxx ii = xxxx ii yyyy ii xxxx ii xxxx ii yyyy ii yyyy ii yyyy ii = ff(xxxx ii ) 만약 yyyy ii yyyy ii < 0 이면, xxxx ii+1 = xxxx ii 만약 yyyy ii yyyy ii > 0 이면, xxxx ii+1 = xxxx ii 최종결과 xxxx eeeeee, eeee eeeeee 획득 xxxx ii+1 = xxxx ii xxxx ii+1 = xxxx ii eeee ii = 100 xx tttttttt xxxx ii xx tttttttt
Newton-Raphson f '( x i ) = f ( xi ) 0 x x i i+ 1 x i+ 1 추정된근의값 = x i f ( xi ) f '( x ) i
Newton-Raphson 다음의방법들을사용하여 ff xx = ee xx xx 의근을구하고, 참백분율상대오차를하나의그래프에함께그려비교하시오. 반복횟수에따른오차의특성을살피고, 각방법들간의차이점에대해논하시오. 참값으로 0.56714329 를사용. iteration 함수및초기치설정 xx tttttttt = 0.56714329 ff xx = ee xx xx ff (xx) = ee xx 1 xx = 0 yy = ff(xx) yyy = fff(xx) eeee 1 = 100 xx tttttttt xx 1 xx tttttttt xx ii+1 = xx ii yy ii yyy 1 yy ii+1 = ff(xx ii+1 ) eeee ii = 100 xx tttttttt xx ii+1 xx tttttttt yyy ii+1 = fff(xx ii+1 ) 최종결과 xx eeeeee, eeee eeeeee 획득
Newton-Raphson coding
Fixed-point iteration 다음의방법들을사용하여 ff xx = ee xx xx 의근을구하고, 참백분율상대오차를하나의그래프에함께그려비교하시오. 반복횟수에따른오차의특성을살피고, 각방법들간의차이점에대해논하시오. 참값으로 0.56714329 를사용. iteration 함수및초기치설정 xx tttttttt = 0.56714329 ff xx = ee xx xx gg(xx) = ee xx xx = 0 yy = gg(xx) eeee 1 = 100 xx tttttttt xx 1 xx tttttttt xx ii+1 = yy ii yy ii+1 = gg(xx ii+1 ) eeee ii = 100 xx tttttttt xx ii+1 xx tttttttt 최종결과 xx eeeeee, eeee eeeeee 획득
Secant 다음의방법들을사용하여 ff xx = ee xx xx 의근을구하고, 참백분율상대오차를하나의그래프에함께그려비교하시오. 반복횟수에따른오차의특성을살피고, 각방법들간의차이점에대해논하시오. 참값으로 0.56714329 를사용. iteration 함수및초기치설정 xx tttttttt = 0.56714329 δδ = 0.000001 ff xx = ee xx xx xx 1 = 1 yyy = ff(xx 1 ) yyy = ff xx 1 + δδxx 1 eeee 1 = 100 xx tttttttt xx 1 xx tttttttt xx ii+1 = xx ii δδ xx ii yyy ii yyy ii yyy ii yyy ii+1 = ff(xx ii+1 ) yyy ii+1 = ff xx ii+1 + δδ xx ii+1 eeee ii = 100 xx tttttttt xx ii+1 xx tttttttt 최종결과 xx eeeeee, eeee eeeeee 획득
Structure & Save Structure Mat 파일로저장
Graph plot 1) Load 2) Plotting
Graph plot 3) Axis control
Graph plot 4) Labeling
Graph plot 5) Legend 6) save
Graph plot Line style: -, --, -., : Color: k(black), b(blue), r(red), m(magenta), g(green) Mat 파일불러오기 Y 축 log-scale 로 plot 그래프선굵기 한그래프에여러 line plot 격자 Line 의형태및색 x & y 축범위설정 Legend ( 범례 ) x 축범위설정및해당값설정 x 축설명 타이틀 y 축설명 저장