Storing and retrieving mathematical equations

11 visualizaciones (últimos 30 días)
Raja Vardhan Reddy Kothakapu
Raja Vardhan Reddy Kothakapu el 10 de Mayo de 2019
Respondida: madhan ravi el 10 de Mayo de 2019
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

Respuesta aceptada

madhan ravi
madhan ravi el 10 de Mayo de 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

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by