Fraud and plagiarismSee the Teaching and Exam Regulations (OER) for a formal definition, and the formal procedures that your lecturer is obliged to follow if he suspects fraud or plagiarism.
Implicit statement of ownershipBy handing in Matlab-assignments and/or homework sets, you implicitly state that you are their sole author; so if we have reason to doubt this, you are in trouble.
At all times you wish to avoid having to explain yourself in front of the Faculty's Fraud and Plagiarism Board.
How to avoid fraud and plagiarismMatlab-codes are your personal codes. It will be detected if you take someone else's code and substitute variable names, change the order of lines, introduce new comments.
You may cooperate with a fellow student, but make sure you do it superficially enough: avoid seeing each others (pieces of) code. The same is valid for homework sets. It is fine to think about a problem together on a global level. Working out the details and writing them down are done by yourself.