Repetition and Discontinuity Function

10 views (last 30 days)
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]
  2 Comments
Geoff Hayes
Geoff Hayes on 22 Feb 2015
Jorge - what does the syntax
<x-20>
mean to you? What about
600<x-240<^3
Is there a typo in the above or does it have some particular meaning?
Image Analyst
Image Analyst on 22 Feb 2015
Also, what does 13.68e6x mean? How about 13.68 * 10^(6*x) or maybe 13.68 * exp(6*x)?

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 22 Feb 2015
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;

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!