Homework 4 L13P1

Homework 4 L13P1 - 13.1%L13P1%Math 344%Homework Problem 13.1 or%Homework Lecture 13 Problem 1 ==>(L13P1%Written by Bob Astrom and Ben Elbert

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: 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 guess x % Display answer f(x) % Display how close to zero the zero vector is end % End uniqueness test lasty = y; % Set rounded vector for next uniqueness test end 13.1) When running what we called L13P1, we were able to find the following solutions 1) (254.2211204388131, 219.3069916050682) 2) (-193.2945540448241, 66.5649013596583) 3) (740.3288221787728, 906.8259399608955) These were the two that we were able to find such that f(x1, x2) equal to or very close to 0. The second solution can be disregarded since distance from the station cannot be negative. For a LORAN system to accurately position a ship using this system of equations, the ship will need to first have a general idea of where it is in relation to the stations to select the appropriate solution. It should be noticed that the as the initial guess increases the answers fluctuate between the possible solutions. Below are the outputs of the program. >> L13P1copy AnswerNumber = 1 InitialGuess = 10 10 x = 1.0e+002 * 2.542211204388131 2.193069916050682 ans = 0 0 AnswerNumber = 2 InitialGuess = 490 490 x = 1.0e+002 * ‐1.932945540448241 0.665649013596583 ans = 0 0 AnswerNumber = 3 InitialGuess = 510 510 x = 1.0e+002 * 2.542211204388131 2.193069916050682 ans = 1.0e‐015 * 0.222044604925031 0 AnswerNumber = 4 InitialGuess = 540 540 x = 1.0e+002 * ‐1.932945540448241 0.665649013596583 ans = 0 0 AnswerNumber = 5 InitialGuess = 550 550 x = 1.0e+002 * 2.542211204388131 2.193069916050682 ans = 1.0e‐015 * 0.222044604925031 0 AnswerNumber = 6 InitialGuess = 560 560 x = 1.0e+002 * ‐1.932945540448241 0.665649013596583 ans = 0 0 AnswerNumber = 7 InitialGuess = 580 580 x = 1.0e+002 * 7.403288221787728 9.068259399608955 ans = 1.0e‐014 * 0.177635683940025 ‐0.022204460492503 ...
View Full Document

This note was uploaded on 01/15/2011 for the course MATH 345 taught by Professor Staff during the Spring '08 term at Ohio State.

Ask a homework question - tutors are online