To compute v1
, you can use element-wise array operations in MATLAB. The expression you provided is a combination of basic arithmetic operations and element-wise operations. Here's the code:
31 chars2 lines
In this code, .*
is the element-wise multiplication operator, used to multiply the corresponding elements of two arrays. ./
is the element-wise division operator, used to divide the corresponding elements of two arrays.
The expression (t./t).^4
is simply 1
for all elements of t
, since each element is divided by itself. Note that v0
and t
must be arrays of the same size, or at least have compatible sizes, in order for this code to work correctly.
gistlibby LogSnag