find v in v(t)= v0 * (1-(t/y).^4).^2 in matlab

To find v in v(t)= v0 * (1-(t/y).^4).^2 in MATLAB, you can write the following function:

main.m
function v = find_v(t, v0, y)
    v = v0 * (1 - (t/y).^4).^2;
end
66 chars
4 lines

Here, t, v0, and y are the input parameters and v is the output. You can call this function with appropriate input parameters, for example:

main.m
>> v = find_v(2, 10, 5)
v =
   6.4000
38 chars
4 lines

This will calculate the value of v at t=2 for v0=10 and y=5. The result will be 6.4.

gistlibby LogSnag