MatLab-Homework1

# MatLab-Homework1 - Homework 5 Functions and Control Flow...

This preview shows pages 1–2. Sign up to view the full content.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Homework 5: Functions and Control Flow This week you will submit three function M-files and two jpeg plots (for problem 3). These M-files should be named geom.m, crossprod.m and collatz.m. We will be executing your files in order to check your work, so the file names must match the expected name of the functions. In order to get full credit, your files and functions must be properly named. 1. Create a function geom that computes the sum of a geometric series 1 + r + r 2 + r 3 + . . . + r n . The inputs for the function must be r and n and the output will be the sum of the series. The first line of your file geom.m should be function s = geom( r,n ) (Hint: the sum command will be helpful.) 2. Write a function crossprod to compute the cross product of two vectors u and v. If u = ( u 1 , u 2 , u 3) and v = ( v 1 , v 2 , v 3), then their cross product is u × v = ( u 2 v 3- u 3 v 2 , u 3 v 1- u 1 v 3 , u 1 v 2- u 2 v 1)....
View Full Document

{[ snackBarMessage ]}

### Page1 / 2

MatLab-Homework1 - Homework 5 Functions and Control Flow...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online