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 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Function Handles についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!