MATH/CMSC 206 - Introduction to Matlab
Announcements | Syllabus | Tutorial | Projects | Submitting |
Answers to Self-Test
1. We are about to manipulate some formulas involving variables a, b, and c. Write the MATLAB command that declares these variables as "symbolic".
syms a b c
2. Write the MATLAB command that will factor the polynomial a^2-b^2
factor(a^2 - b^2)
ans = (a - b)*(a + b)
3. Write the MATLAB command that will multiply a+b+c by a^2-b^2, leaving no parentheses in it's answer.
expand((a + b + c) * (a^2 - b^2))
ans = a^3 + a^2*b + c*a^2 - a*b^2 - b^3 - c*b^2
4. Write the MATLAB command that will simplify the expression: ln(6x)-ln(3x).
simplify(log(6 * a) - log(3 * a))
ans = log(2)