To create a function t=pe^rt in MATLAB with given input parameters, you can follow the below code:
main.m315 chars12 lines
In the above code, function
is used to define a function in MATLAB, p
, r
, and t
are input parameters and t
is the output. exp
function is used to calculate exponential and the formula pe^rt
is used to calculate the total amount.
You can save this function with any filename, for example, calculate_loan.m
and run this function from command window or any other script by passing input parameters p, r, t
to get the output t
.
gistlibby LogSnag