MATLAB: Repetition and Discontinuity Function

functionrepetition

I want to create a function that evaluates:
v = 1/3.190e9*(800x^3 - 13.68e6x - 2.5x^4 + 2.5<x-120>^4 + 600<x-240<^3)
<x-a>^n = (x-a)^n if x>=a and 0 if x<a
The user would input an array like [0:.5:360]

Best Answer

How about
function test
x = [0:.5:360];
a = 10; % Whatever...
v = vx(x, a) % Call the vx function.
function v = vx(x, a)
x(x<a) = 0;
v = (1/3.190e9) * 800 * x .^ 3 - ...
13.68 * 10 .^ (6 * x) - ...
2.5 * x .^ 4 + ...
2.5 * (x - 120) .^ 4 + ...
600 * (x - 240) .^ 3;
Related Question