2-3-11 - D = B^2-(4*A*C); >> If this...

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

View Full Document Right Arrow Icon
2/3/11 MATLAB HOMEWORK: 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 horizontal semi- axis: ‘); b = input (‘Enter value for vertical semi-axis: ‘); >>after solving A = B = C = D = B^2-(4*A*C) >> 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; >>create a vector v = [x1 y1 x2 y2]; disp(v); CONTINUING from last class: circle-line intersection with if statement 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: ‘); b = input (‘Enter value for y-center: ‘); r = input (‘Enter value for radius: ‘); >>after solving
Background image of page 1

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

View Full DocumentRight Arrow Icon
2/3/11 A=m^2 +1 B= -2*a+2*(c-b)*m; C=a^2 +(c-b)^2 –r^2;
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: D = B^2-(4*A*C); >> If this value < 0, there are no solutions, your line doesn't intersect the ellipse. if d < 0 v=no solution >> Else, D = ___, there's exactly one tangent touching point, or if D > 0 there are two intersections. else x1=(-B-sqrt(D))/(2+A); x2 = (-B +sqrt(D))/(2+A); y1 = m*x1 +c; y2 = m*x2 +c; >>create a vector v = [x1 y1 x2 y2]; end disp(v); pg 94 in book grade = input (What grade? ) if grade >= 90 letter = A; elseif grade >= 80 letter = B; elseif grade >= 70 letter = C; elseif grade >= 60 letter = D; else letter = F; end disp (letter) Lets make it more complex! 2/3/11 grade = input (What grade? ) if (grade >= 90) && (grade <=95) letter = A; elseif grade >= 80 letter = B; elseif grade >= 70 letter = C; elseif grade >= 60 letter = D; else letter = F; end disp (letter)...
View Full Document

Page1 / 3

2-3-11 - D = B^2-(4*A*C); >> If this...

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

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