To create the function t=pe^rt in Matlab, you should start by defining a function that takes in three arguments: p, r, and t. This function will calculate the value of pe^rt by multiplying p with the exponential of rt.
main.m68 chars4 lines
The exp
function in Matlab returns the exponential function e^x, where x is the input argument. In this case, we use r*t
as the input argument to get e^(rt).
Once you have defined this function, you can call it with values for p, r, and t to calculate the result.
For example:
main.m44 chars4 lines
This calculates the value of 2e^(0.1*5), which is approximately equal to 2.0138.
gistlibby LogSnag