Storing and retrieving mathematical equations

12 Ansichten (letzte 30 Tage)
Raja Vardhan Reddy Kothakapu
Beantwortet: madhan ravi am 10 Mai 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

Akzeptierte Antwort

madhan ravi
madhan ravi am 10 Mai 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

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by