intoptics
Newbie level 2
Hi dear all,
my function values is like this:
a(1) for x<0,a(2) for 0<x<l(1),a(3) for l(1)<x<l(2),..,a for x>l(n-2),
that these 2 are known:
a=[a1 a2 .. an] and l=[l1 l2 .. l(n-2)] l(n-2) just means this matrix have 2 values less than a.
for less values of a & l, I put them directly in function like this:
for example a=[1 2 3 4] and l=[2 3]
p=@(x) a(1)*(x<0)+(a(2))*(x>0)+(a(3)-a(2))*(x>l(1))+(a(4)-a(3))*(x>(l(1)+l(2)));
now I wanna use this type function in loop with more values in a and l matrices.
my function values is like this:
a(1) for x<0,a(2) for 0<x<l(1),a(3) for l(1)<x<l(2),..,a for x>l(n-2),
that these 2 are known:
a=[a1 a2 .. an] and l=[l1 l2 .. l(n-2)] l(n-2) just means this matrix have 2 values less than a.
for less values of a & l, I put them directly in function like this:
for example a=[1 2 3 4] and l=[2 3]
p=@(x) a(1)*(x<0)+(a(2))*(x>0)+(a(3)-a(2))*(x>l(1))+(a(4)-a(3))*(x>(l(1)+l(2)));
now I wanna use this type function in loop with more values in a and l matrices.