Monday, May 4, 2015

MATLAB

Using Physical Modeling in MATLAB by Allen B. Downey, my partner an I were introduced to MATLAB 
Exercise 2.1 We used the Fibonacci sequence formula: 
and translated it into MATLAB. We calculated the answer at n = 10.



Exercise 2.3 We designed a script to calculate the number of cars at two different car rental locations from week to week. Each time we ran the program, the number of cars would be updated from week to week.


We set a to equal the number of cars in Albany and b to equal the number of cars in Boston. We set both variables to 150 cars.


This is after the first week (there would be 147 cars in Albany in 153 in Boston).

And after continually running the program.


Exercise 3.1 We used a for loop and the script from the exercise above to create a program that automatically calculated how many cars would be at each location after 52 weeks without having to run the program 52 times.


Exercise 3.2 We used the MATLAB graph function to plot how the amount of cars at each location changed after 52 weeks.


Exercise 3.5 This used the Fibonacci sequence again, this time finding the first ten numbers using a loop. We also generalized our script so that you could calculate the nth element of n with the precondition that you have to set n before running the script.



We continued the next few days with working with MATLAB and thermal systems.

No comments:

Post a Comment