Assuming that t
is a vector with the desired time samples, the function values can be computed using element-wise arithmetic operations and built-in functions as follows:
main.m90 chars3 lines
The first line defines t
as a vector that ranges from 0 to 100 with a step size of 0.1. The second line defines f3
as a vector with the same length as t
, where the function values are computed element-wise using the sin
, exp
, and power (.^
) functions.
gistlibby LogSnag