there is this method I used the other day and I have forgotten the details, which in we used a syntax like this:
f=//command//(x,'sin(x)');
something like this. im not sure if the syntax is fully correct, or what the right command is. but after this we could simply ask for the f(x) value like this:
x= 0;
y= f(x);
and then the results were y=0;
What you are asking for is usually not recommendable. Please check if a simple anonymous function also fits your requirements:
f=@(x)(sin(x))
In case you really need to evaluate from a string:
f=str2func('@(x)sin(x)')
I would advice against the second option unless absolutely required, it can lead to hard to debug errors.
Or simply
f=str2func('sin')
.thank u, it was absolutely required!