Homework 4

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Homework 4 Lectures 13‐16 Math 344 Ohio University Spring Quarter 09’‐10’ Bob Benjamin Astrom Elbert 13.1) %L13P1 %Math 344 %Homework Problem 13.1 % or %Homework Lecture 13 Problem 1 ==> (L13P1) %Written by Bob Astrom and Ben Elbert format long n=50; % set some number of iterations, may need adjusting m=60; % Set number of iterations for initial guess lasty = [0; 0]; % Set vector to identify answer change filler = 0; % Just a place holder not important AnswerNumber=0; % Set counter for the number of the answer f = inline('[(x(1).^2/186.^2) - (x(2).^2/(300.^2 - 186.^2)) - 1 ; ((x(2) 500).^2/279.^2) - ((x(1) - 300).^2/(500.^2 - 279.^2)) - 1]'); % the vector function Df = inline('[2*(x(1)/186^2), -2*(x(2)/(300^2 - 186^2)) ; -2*((x(1) 300)/(500.^2 - 279.^2)), 2*((x(2) - 500)/279.^2)]'); % the matrix of partial derivatives for l = 1:m % Loop to change initial guess x = [10*l;10*l]; % Initial guess InitialGuess = x; % Store initial guess for later display for i = 1:n % Loop for actual calculation Dx = -Df(x)\f(x); % solve for increment x = x + Dx; % add on to get new guess f(x); % see if f(x) is really zero end % End calculation loop y = x*1000; % Decimal place shift for rounding y = round(y); % Creat rounded answers for uniqueness test if y == lasty % Check to see if answer has not changed filler = 0; % Here just for the heck of it else % Check to see if answer has changed AnswerNumber = AnswerNumber + 1 % Answer # counter and display InitialGuess % Display initial...
View Full Document

Ask a homework question - tutors are online