Storing and retrieving mathematical equations

10 ビュー (過去 30 日間)
Raja Vardhan Reddy Kothakapu
Raja Vardhan Reddy Kothakapu 2019 年 5 月 10 日
回答済み: madhan ravi 2019 年 5 月 10 日
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
madhan ravi 2019 年 5 月 10 日
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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by