How can I pass a character function to the input of another function?
1 view (last 30 days)
Show older comments
Hello! I had the following problem. I need to make it so that I can enter a symbolic function, which will later be used:
F = s.*exp(s.*t);
and I need to use this function as an input to another example:
function Example(Aval, Bval, Cval ,Dval, Nval, Mval, F)
hs = (Bval - Aval)/(Nval - 1);
ht = (Dval - Cval)/(Mval - 1);
Sval = (Aval:hs:Bval)';
Tval = (Cval:ht:Dval)';
Amat = zeros(Mval,Nval);
hs = (Tval(Nval) - Tval(1))/(Nval - 1);
for i=1:Mval,
Amat(i,1) = F(Sval(i),Tval(1))/2;
for j=2:(Nval-1),
Amat(i,j) = F(Sval(i),Tval(j));
end
Amat(i,Nval) = F(Sval(i),Tval(Nval))/2;
end
Amat = hs*Amat;
end;
The problem is that I need to do this for codegen. How can I do it?
myhelp = {ones(1,1,'double'),ones(1,1,'double'),ones(1,1,'double'),ones(1,1,'double'),ones(1,1,'double'),ones(1,1,'double'), ???????????};
codegen Example.m -args myHelp
0 Comments
Answers (0)
See Also
Categories
Find more on Function Handles in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!