Newton Method, Broyden Method 2-Numerical Analysis-MATLAB Code, Exercises of Mathematical Methods for Numerical Analysis and Optimization

This is solution to one of problems in Numerical Analysis. This is matlab code. Its helpful to students of Computer Science, Electrical and Mechanical Engineering. This code also help to understand algorithm and logic behind the problem. This code includes: Newton, Method, Broyden, Function, Result, Algorithm, Systems, Define, Jacobian, Nonlinear, Inline, Conditional, Statement

Typology: Exercises

2011/2012

Uploaded on 07/31/2012

saripella
saripella 🇮🇳

4.4

(132)

169 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
function [res] = JAC(I,J,M,V,ss)
% This function is used by Newton's Method for Systems and
% by Broyden's Method (Algorithms 10.1 and 10.2) to define
% the Jacobian.
if M == 2
g = inline(ss((I-1)*M+J),'y1','y2');
res = g(V(1),V(2));
elseif M == 3
g = inline(ss((I-1)*M+J),'y1','y2','y3');
res = g(V(1),V(2),V(3));
elseif M == 4
g = inline(ss((I-1)*M+J),'y1','y2','y3','y4');
res = g(V(1),V(2),V(3),V(4));
elseif M == 5
g = inline(ss((I-1)*M+J),'y1','y2','y3','y4','y5');
res = g(V(1),V(2),V(3),V(4),V(5));
elseif M == 6
g = inline(ss((I-1)*M+J),'y1','y2','y3','y4','y5','y6');
res = g(V(1),V(2),V(3),V(4),V(5),V(6));
else
g = inline(ss((I-1)*M+J),'y1','y2','y3','y4','y5','y6','y7');
res = g(V(1),V(2),V(3),V(4),V(5),V(6),V(7));
end;
docsity.com

Partial preview of the text

Download Newton Method, Broyden Method 2-Numerical Analysis-MATLAB Code and more Exercises Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

function [res] = JAC(I,J,M,V,ss) % This function is used by Newton's Method for Systems and % by Broyden's Method (Algorithms 10.1 and 10.2) to define % the Jacobian. if M == 2 g = inline(ss((I-1)M+J),'y1','y2'); res = g(V(1),V(2)); elseif M == 3 g = inline(ss((I-1)M+J),'y1','y2','y3'); res = g(V(1),V(2),V(3)); elseif M == 4 g = inline(ss((I-1)M+J),'y1','y2','y3','y4'); res = g(V(1),V(2),V(3),V(4)); elseif M == 5 g = inline(ss((I-1)M+J),'y1','y2','y3','y4','y5'); res = g(V(1),V(2),V(3),V(4),V(5)); elseif M == 6 g = inline(ss((I-1)M+J),'y1','y2','y3','y4','y5','y6'); res = g(V(1),V(2),V(3),V(4),V(5),V(6)); else g = inline(ss((I-1)M+J),'y1','y2','y3','y4','y5','y6','y7'); res = g(V(1),V(2),V(3),V(4),V(5),V(6),V(7)); end;

docsity.com