How can I pass a character function to the input of another function?

1 次查看(过去 30 天)
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 个)

类别

Help CenterFile Exchange 中查找有关 Function Handles 的更多信息

产品


版本

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by