line_length - % % x1,y1,x2,y2 - different x and y variables...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
function d = line_length(x1,y1,x2,y2) f %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % Programmer(s) and Purdue Email Address(es): % % 1. rpereir@purdue.edu % % % Section #: 07 % % % Assignment #: homework 3 activity 2 % % % Academic Integrity Statement: % % % I/We have not used source code obtained from % % any other unauthorized source, either modified % % or unmodified. Neither have I/we provided access % % to my/our code to another. The project I/we am/are % % submitting is my/our own original work. % % % FUNCTION NAME:the purpose is to calculate the length of a line segment % % INPUTS: List them below one line per input argument
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % % x1,y1,x2,y2 - different x and y variables for points on a line % % % % OUTPUTS: List them below line per output argument % % d - the distance of the line % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % d = sqrt((x2-x1)^2+(y2-y1)^2); %calculates length of the line segment d % results to the tested input values: % % line_length(1,1,4,5) % % % % ans = % % % % 5 % % % % line_length(4,6,2,3) % % % % ans = % % % % 3.6056 % % line_length(7,1,7,8) % % % % ans = % % % % 7 % % line_length(6,4,9,4) % % % % ans = % % % % 3 % end e...
View Full Document

Page1 / 2

line_length - % % x1,y1,x2,y2 - different x and y variables...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online