Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
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

Respuestas (0)

Categorías

Más información sobre Function Handles en Help Center y File Exchange.

Productos


Versión

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by