How to convert a symbolic variable to an ordinary variable?
Show older comments
Hello. I have some code that looks like this (it's not that simple but the problem can be reduced to the following lines):
syms x y real;
A = [x y; 1 2];
for i = 1:10
x = i;
y = 2;
B = subs(A) % could also be: B=eval(A)
end
Is there a way i can make x and y ordinary variables again? Eval and Subs are too slow and consume 95% of runtime.
I use symbolic variables because in my code I get A by differentiating some expressions. After that A doesn't change anymore and I only want to evaluate A for different values of x and y.
Accepted Answer
More Answers (0)
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!