Transformation of a MATLAB Function.
5 ビュー (過去 30 日間)
古いコメントを表示
Fawad Farooq Ashraf
2021 年 3 月 13 日
編集済み: Fawad Farooq Ashraf
2021 年 3 月 14 日
I have a function defined as,
f_xw = @(x,w) [3.*x(1) - x(1).^2/7 + w(1);
-2.*x(2) + w(2)];
I want to transform this from x coordinate system to \eta coordinate system which would look like
f_etaw = @(eta,w) [3.*(c1+G1*eta) - (c1+G1*eta).^2/7 + w(1);...
-2.*(c2+G2*eta) + w(2)];
where i define eta as symbolic variables
eta = sym('eta',[2 1]);
and c's are constants numbers (1x1) and G's are constant row vectors (1x2) which i can define globally.
Is there a way to do this transformation using matlabFunction command? And can this transformation be made general for all functions with n states?
0 件のコメント
採用された回答
Steven Lord
2021 年 3 月 13 日
f_xw = @(x,w) [3.*x(1) - x(1).^2/7 + w(1);
-2.*x(2) + w(2)];
f_etaw = @(eta,w) [3.*(c1+G1*eta) - (c1+G1*eta).^2/7 + w(1);...
-2.*(c2+G2*eta) + w(2)];
So instead of x(1) you want to use c1+G1*eta and instead of x(2) you want to use c2+G2*eta?
% assuming c1, c2, G1, and G2 already exist
f_etaw = @(eta, w) f_xw([c1+G1*eta, c2+G2*eta], w);
And can this transformation be made general for all functions with n states?
Assuming c and G are vectors that are the same size as the x input with which f_xw expects to be called:
% assuming c and G already exist
f_etaw = @(eta, w) f_xw(c+G*eta, w);
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Function Creation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!