Lab B - Problem 4-A.17 A syntax error is typically much...

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

View Full Document Right Arrow Icon
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Problem 4-A.17: % % A syntax error is typically much easier to detect than a runtime % error. Syntax errors are trapped by MATLAB because a syntax % error is caused by a misuse in some way of the language of % MATLAB. A runtime (or logic) error on the other hand involves no % misuse of the MATLAB language, but rather a flaw in the logic of % the code. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Problem 4-A.18: % % Part A: forgot multiplication sign after 5… % y = 5*(8-5)^2/7 % % Part B: multiple errors: (1) sine and cosine take round % parenthesis, not square brackets, (2) forgot % multiplication sign in both sine and cosine terms… % tan45 = sin(45*(pi/180))/cos(45*(pi/180)); % % Part C: raising a sine factor is accomplished by putting the % <caret> *after* the entire sine term … % sinSquare45 = sin(45*pi/180)^2 % % Pard D: the left hand side of a assignment statement can % include a variable name or variable names only. No
Background image of page 1

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

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

This note was uploaded on 03/30/2008 for the course CSE 131 taught by Professor Sticklen during the Spring '08 term at Michigan State University.

Page1 / 2

Lab B - Problem 4-A.17 A syntax error is typically much...

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

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