ECE 3040
Lecture 6: Programming Examples
© Prof. Mohamad Hassoun
This lecture provides the solution for several programming problems
Plotting piecewise functions
Computing the factorial of a number
Beeping
Looping vs vectorization speed:
tic
and
toc
commands
Passing
an “
anonymous
function” to Matlab function
Approximation of definite integrals: Riemann sums
Computing
cos(?)
from its power series
Stopping criteria for iterative numerical methods
Computing the square root
Evaluating polynomials
Appendix: Errors and Significant Digits

** Subscribe** to view the full document.