This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: MMAE 350 D. Rempfer Problem Set I Page 1 of 2 Due Date: September 11, 2006 1. Consider the following two MATLAB m-files: – The first one, called test1.m only contains one line: a=1 – The second one, called test2.m is this function test2() a=1 end a. Start a new MATLAB session and run the first program. What is the value of the variable a ? b. Type clear to erase the workspace and then run the second program. What is the value of the variable a ? c. Explain the di ff erence between the two cases. 2. The Lucas numbers ` i are defined recursively, through the prescriptions ` 1 = 1 , ` 2 = 3 , ` i + 1 = ` i- 1 + ` i . (1) Thus, we get the series 1, 3, 4, 7, 11, 18, 29, 47, 76, 123 etc. Write a MATLAB function lucas , function fnumbers=lucas(n) ... that takes as its input value the number of terms n to generate, and produces as its output a vector containing the first n Lucas numbers. a. Write the function using a for loop....
View Full Document
This note was uploaded on 05/04/2008 for the course MMAE 350 taught by Professor Rempher during the Spring '05 term at Illinois Tech.
- Spring '05