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

Info icon This 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 % operators or functions are allowed on the left hand % side. It is difficult to “guess” at what the author of % the code line in Part D meant. When faced with this %
Image of page 1

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern