How do i convert x^2 to x.^2 (for example)
5 views (last 30 days)
Show older comments
Jose Polanco
on 13 Nov 2015
Commented: Irabiel Romero
on 29 Dec 2017
So im doing a area between curves calculator, i have the symbolic part to graficate, but i also need the expression like a mathlab function for something of my code, i used to use the function 'matlabFunction' but it returns me this as example:
syms x; //declared of the start of code
f=x^2
f1=matlabFunction(f)
but f1 returns (@x)x.^2, i need that but without (@x), im not expert at MATLAB, so what im doing wrong or what i need to do? I'll appreciate your help!
0 Comments
Accepted Answer
Walter Roberson
on 14 Nov 2015
You can apply that to char() of a symbolic expression if you need to, and sym() the result, but be warned that if you do then variables named might lose any special properties like assumptions.
3 Comments
Walter Roberson
on 20 Nov 2015
"inline will be removed in a future release. Use Anonymous Functions instead."
Irabiel Romero
on 29 Dec 2017
Thank you guys this helped me out with my program. well in particular inline(vectorize(f)) was the line that helped me finish it.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!