|
Create MATLAB function that has four inputs
and two inputs.
The four inputs are the coordinates of two points
(x1,y1) and (x2, y2)
and the output will be the slope and y intercept of the line
between the points.
Make sure that the function will allow for the possible
cases of
- Two points with the same x values and different y values.
This should return the a result stating that you have a vertical line
and then give the equation of a vertical line.
- Two points with the same x and y values.
This should returna result saying that only one point has been given.
You will want to look at the MATLAB help information on using the for-elseif
command.
- Open MATLAB, type "edit" into
command window, and then type your code into the editor window.
- Include comments statements to indicate what you are doing. Comment
are indicated with %% at the beginning of the line.
- Save your file as myline.m
- Run the above code by pressing F5. Edit and run until everything
works okay.
- Include a comment statement to
indicate your name.
- Paste your code into an e-mail and send. I
will run the code and see your
results.
Get help from http://www2.ohlone.edu/people2/bbradshaw/matlab/programming.html
|