Transformation of a MATLAB Function.
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Fawad Farooq Ashraf
am 13 Mär. 2021
Bearbeitet: Fawad Farooq Ashraf
am 14 Mär. 2021
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 Kommentare
Akzeptierte Antwort
Steven Lord
am 13 Mär. 2021
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);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Function Creation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!