# Storing and retrieving mathematical equations

9 views (last 30 days)
Hi everyone,
I'm trying to create some mathematical equations and store them some how in struct or cells. My equations contains highly nonlinear terms and they are chosen from vast range of possibilites, which also includes delay terms. For example
Equation 1 : G(t) = [X(t)^2 X(t-4)^2 X(t)*Y(t) Z(t) X(t)^2*Z(t) X(t)*Y(t-4) ] * [theta_1,....................,theta_6]';
Equation 2 : G(t) = [X(t)^3 X(t-2)^2 X(t-2)*Y(t-2) X(t)*Y(t) X(t-2)*Y(t) ] * [theta_1,..........................theta_5];
There are atleast 100 of this equations and i need to pick best model by comparing the error. Firstly, I don't know how to store this equations and then I thought of converting them in to 'string' and retrieving back using eval() command. But, i read lot of comments suggesting it is a bad way to store and retrieve equations.
Can someone suggest me an alternative and efficient way to store and retrieve equations?
Thanks

madhan ravi on 10 May 2019
An example :
syms x
G = cell(3,1);
for k=1:3
G{k} = matlabFunction(k*x^2);
end
G{2}(4) % 2 second eqn & 4 argument of the eqn

### Categories

Find more on Choose a Solver in Help Center and File Exchange

R2018a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!