How to change anonymous function to take array parameter and subject to ranges
Afficher commentaires plus anciens
Hi, I have a working anonymous function that takes a vector of size 1x3 and I want to expand this to 3x3. The function is named mu_x and looks like this
mu_x=@(t) f_lx(t,param);
function res=f_lx(x,param)
a=param(1);
b=param(2);
c=param(3);
res = zeros(size(x));
ind = x>100;
res(ind) = a+b*exp(c*100)+(x(ind)-100)*0.001;
res(~ind) =a+b*exp(c*x(~ind));
end
The 1x3 param is now [a b c] and the 3x3 parameter I want to use is subject to x such as:
x=65-59 param(:,1)
x=70-76 param(:,2)
x=77-106 param(:,3)
just to clarify the new param looks something like this
a1 b1 c1
a2 b2 c2
a3 b3 c3
How can the anonymous function be changed to consider the ranges of x and new format of param?
Réponse acceptée
Plus de réponses (1)
Catégories
En savoir plus sur Operators and Elementary Operations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!