call an equation within the function
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Soumili Sen
el 27 de Oct. de 2020
Comentada: Soumili Sen
el 27 de Oct. de 2020
hello,
I am writing a code like,
syms x y;
data=2*x^2+3*x+y;
function f= obj(x,y)
f=@data;
end
but here 'f' is not calling the equation 'data' within the function. what will be the command so that 'f' can call the data in this function?
2 comentarios
David Hill
el 27 de Oct. de 2020
What are you trying to do? Please explain with an example. Is there a reason you need symbolic variables?
Respuesta aceptada
David Hill
el 27 de Oct. de 2020
You can pass the data function to your other function. Not sure this helps. I still don't know exactly what you are trying to do.
data=@(x,y)2*x.^2+3*x+y;
function f = obj(x,y,data)
f=data(x,y);
end
Más respuestas (0)
Ver también
Categorías
Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!