Converts a string into a function to plot
Mostrar comentarios más antiguos
So I have mathematic functions like sin(x), cos(x) etc. in a string format that I want to convert into a function so I would be able to plot it.
equ='sin(x)';
f= @(x) equ;
plot(x,f)
error message:
Error using plot
Invalid data argument.
2 comentarios
"So I have mathematic functions like sin(x), cos(x) etc. in a string format that I want to convert into a function..."
Your example contains no strings or character arrays at all:
equ=sin(x);
f= @(x) equ;
This makes your question difficult to interpret. Do you actually have a character vector? E.g.:
str = 'sin';
Please show the actual definition of your input data.
iseinas
el 4 de Sept. de 2020
Respuesta aceptada
Más respuestas (1)
Categorías
Más información sobre Title en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

