Write an algorithm to settle the following question: A bank account starts out with$10,000. Interest is compounded monthly at 6 percent per year (0.5 percent permonth). Every month, $500 is withdrawn to meet college expenses. After how manyyears is the account depleted?
ENGR 121 B Lab Notes for 10/12/2016 Spencer Kociba ● Function writing in MATLAB ○ Function output=name(input) ○ End (final line in the function code ○ Assign a value to your output argument in the body of the function. ○ When saving, make the file name the same as the function name ○ Function[ ___, ___] ■ To put multiple output arguments (same with the input) ■ With multiple outputs, need to put a vector 1xn outputs in order to see all of them displayed ● To comment on a group rather than a line you must use %{%} but they must be on separate lines ○ Ex. %{ This ■ Is ■ A comment ■ %} ● global(x) ○ Makes the variable globally available across the script and functions used and keeps that assignment the same ● Unless denoted differently, variables used by the function are only local to that function, use global to make this variable inside and outside the function