Lec2 - 1. Basics Variables and Expressions Assignment...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: 1. Basics Variables and Expressions Assignment Statements Built-In Functions Scripts Comments Keyboard Input Formatting Output Approach Preview key concepts by first playing with Matlab as a calculator. From formula to program. Three Formulas 2 ) cos( 1 ) 2 / cos( x x + = Surface Area of a Sphere Half-Angle Quadratic Equation a ac b b r 2 4 2 + = 2 4 r A = Surface Area Increase >> r = 6365; >> delta = .000001; >> A_plus = 4*pi*(r+delta)^2; >> A = 4*pi*r^2; >> Increase = A_plus - A Increase = 0.15996992588043 Cosine(15 degrees) >> c = cos(pi/3); >> c = sqrt((1+c)/2); >> c = sqrt((1+c)/2) c = 0.96592582628907 >> c15 = cos(pi/12) c15 = 0.96592582628907 X 2 + 5x + 6 = (x+2)(x+3) >> a = 1; >> b = 5; >> c = 6; >> d = sqrt(b^2 - 4*a*c); >> r1 = (-b - d)/(2*a) r1 =-3 >> r2 = (-b + d)/(2*a) r2 =-2 Question Time > X = 8; > Y = X; > X = Y; > X = 2*X; > Y = Y/2; What is the final value of X and Y ? A. X is 16 and Y is 16 C . X is 16 and Y is 4 B . X is 8 and Y is 8 D. X is 8 and Y is 4 Lets Revisit the Key Ideas Above and Introduce Others A Script % Quad1 % Solves x^2 + 5x + 6 = 0 a = 1; b = 5; c = 6; d = sqrt(b^2 -4*a*c); r1 = (-b - d)/(2*a) r2 = (-b + d)/(2*a) Script A sequence of instructions....
View Full Document

This note was uploaded on 02/28/2008 for the course CS 100 taught by Professor Fan/vanloan during the Fall '07 term at Cornell University (Engineering School).

Page1 / 36

Lec2 - 1. Basics Variables and Expressions Assignment...

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

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