Presentation is loading. Please wait.

Presentation is loading. Please wait.

ECE602 BME I Nonlinear Equations in Biomedical Engineering (Cont’d)

Similar presentations


Presentation on theme: "ECE602 BME I Nonlinear Equations in Biomedical Engineering (Cont’d)"— Presentation transcript:

1 ECE602 BME I Nonlinear Equations in Biomedical Engineering (Cont’d)

2 Newton-Raphson method x 0 : initial guess Iterative formula: Terminating condition: Convergence condition: x 0 should be close to x*.

3 Newton’s method for Nonlinear System x 0 : initial guess Iterative formula: Terminating condition: Convergence condition: x 0 should be close to x*.

4 Implementation Issues How to define a math function ? How to use a math function as an argument? Ex. function f=fn1(x) f=x.^3-10*x.^2+29*x-20; function x=fn2(fn,x0) %fn: function name x=feval(fn,x0); >> f=fn2('fn1',5) f = 0

5 Implementation Issues How to define a math function ? How to use a math function as an argument? Ex. function f=fn3(v) x=v(1); y=v(2); f=zeros(2,1); f(1)=x^2+y^2-4; f(2)=x*y-1; >> x0=[1;1]; >> feval('fn3',x0) ans = -2 0

6 Implementation Issues How to define a math function ? How to use a math function as an argument? Ex. function jf=fn4(v) %Jacobian matrix definition x=v(1); y=v(2); jf=zeros(2,2); jf(1,:)=[2*x 2*y]; jf(2,:)=[y x]; >> x0=[1;1]; >> feval('fn4',x0) ans = 2 2 1 1

7 Implementation Issues \ Backslash or left matrix divide. If A is an N-by-N matrix and B is a column vector with N components, or a matrix with several such columns, then X = A\B is the solution to the equation A*X = B computed by Gaussian elimination. A warning message is printed if A is badly scaled or nearly singular. >> A=rand(4,4) A = 0.9501 0.8913 0.8214 0.9218 0.2311 0.7621 0.4447 0.7382 0.6068 0.4565 0.6154 0.1763 0.4860 0.0185 0.7919 0.4057 >> b=A*ones(4,1) b = 3.5846 2.1761 1.8550 1.7021 >> x=A\b x = 1.0000


Download ppt "ECE602 BME I Nonlinear Equations in Biomedical Engineering (Cont’d)"

Similar presentations


Ads by Google