This is not so much a FAQ as a page of Frequently Brought Up Issues (FBUI?).
- In Project 1 and Project 2 it doesn't matter if you end your
lines with semicolons or not.
Whether the values are printed doesn't affect the grading software.
- It's good practice to make sure your command are compound commands.
For example if you want to calculate sin(cos(55)) and assign it to p7
(I'm making that problem up) you could, in theory, do:
cos(55)
sin(ans)
p7 = ans
but that's a bit crazy and it's far easier and more sensible to just do:
p7 = sin(cos(55))
- If you do something like:
syms x
and then later if you do something like:
x = 100
note that x is no longer symbolic and if you try to use
it in an equation later like:
solve(x^2+x==5)
you will get an error since x is a constant now and Matlab
can't find a variable to solve for.
- There are two videos on youtube related to writing function
m-files which I created a few years ago.
They may help you figure out what's going on if you're
completely lost on Project 3. They are:
https://www.youtube.com/watch?v=syThKzMAgHs
and
https://www.youtube.com/watch?v=5KuALdU4Kw4&t=2s
- On Project 3, various correct approaches to the problems may produce slightly
different answers due to rounding issues which differ from approach to approach.
Basically the values should almost be exactly the same but if they differ
after the 8th decimal digit that's fine. If they differ earlier then you almost
certainly have something not right!
- If you get code complaints about needing .* or ./ or .^ then quite possibly you are
using an incorrect command somewhere. Classic example is using
integral
when you should be using
int
The first does a numerical approximation, which generally you don't want,
and requires .*, ./ and .^, but the second does an actual proper integral,
and doesn't require those.