2-8-11 - %DO NOT assume that square root of quadratic is...

This preview shows page 1. Sign up to view the full content.

2/8/11 MATLAB Now include an “if statement”: clear home %We need to set values or get a, b, r, m, and c (user inputs) m = input ('Enter value of slope: '); c = input ('Enter value of y-intercept: '); a = input ('Enter value of horizontal semi- axis: '); b = input ('Enter value of vertical semi-axis: '); %after solving A = (a^2+b^2); B = (2*m*b^2); C = (b^4-(a^2)*(b^2)); D = B^2-(4*A*C);
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: %DO NOT assume that square root of quadratic is positive If (d >= 0) x1=(-B +sqrt(D))/(2*A); x2=(-B -sqrt(D))/(2*A); y1 = m*x1 +c; y2 = m*x2 +c; else disp (‘no solution’); end %create a vector v = [x1 y1 x2 y2]; disp(v); \n = like an enter sign at the end of code (see monthdays code) Homework due Friday (2/11/11) @ 11:55pm pg 111 #6 pg 112 #10...
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.

Ask a homework question - tutors are online