1-27-11

# 1-27-11 - ); 1/27/11 b = input (Enter value for y-center:...

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

1/27/11 MATLAB CAME LATE… Look over: Linspace Sum Min Max(h) o Gets max of columns mean Identity matrix Fha = eye(3) Fha*105 Zeros(3,4) Ones(3,4) Ans*2 Example: Line and circle in an x-y-z space Circle: (x - h) 2 + (y - k) 2 = r 2 Line: y=mx +b Plug y equation in to circle equation Use quadratic equation to solve for roots Now… when a=h, b =k, and b=c (x - a) 2 + (y - b) 2 = r 2 and y=mx +c A=m^2 +1 B= -2a+2(c-b)m C=a^2 +(c-b)^2 –r^2 Plug values in to quadratic equation Let’s code it now! clear home or clc >>We need to set values or get a, b, r, m, and c (user inputs) m = input (‘Enter value for slope: ‘); c = input (‘Enter value for y-intercept: ‘); a = input (‘Enter value for x-center:

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

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

Unformatted text preview: ); 1/27/11 b = input (Enter value for y-center: ); r = input (Enter value for radius: ); &gt;&gt;after solving A=m^2 +1 B= -2*a+2*(c-b)*m C=a^2 +(c-b)^2 r^2 D = B^2-(4*A*C) &gt;&gt; assume that square root of quadratic is positive x1=(-B +sqrt(D))/(2*A); x2=(-B -sqrt(D))/(2*A); y1 = m*x1 +c; y2 = m*x2 +c; &gt;&gt;create a vector v = [x1 y1 x2 y2]; disp(v); ASSIGNMENT: Write code that will compute the intercept of a line and ellipse on the xyz-plane Center = (0,0) Ellipse: ((b^2)*(x^2)) + ((a^2)*(y^2)) = ((a^2)*(b^2)) Line: y=mx+c b=minor axis a= major axis Need input for m, c, a, and b Output: (x1, y1) (x2, y2)...
View Full Document

## This note was uploaded on 05/01/2011 for the course HCSC 110 taught by Professor Amosjohnson during the Spring '11 term at Morehouse.

### Page1 / 2

1-27-11 - ); 1/27/11 b = input (Enter value for y-center:...

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

View Full Document
Ask a homework question - tutors are online