Result for solve( ) with minimized number of parameters
Mostra commenti meno recenti
I have an underdetermined system with the following variables:
vars = [x1;u;x2;x1_d;u_d;x2_d]
and the following equations:
eq = [x2_d == 0;
log(x2) + sin(u) == 0]
I want to solve the system using the 'ReturnConditions' function, in order to get a parametrized solution.
Is it possible to obtain a parametrization such that the number of parameters is minimized? For example, if I run in this case the following:
Sol = solve(eq, [u;x2], 'ReturnConditions', true)
I get the following solution:
Sol.parameters = [k, z4, z5, z6, z7]
Where the second equations was parametrized as u in terms of x2:
Sol.x2 = z5
Sol.u = pi + asin(log(z5)) + 2*pi*k
However, if the solver would have chosen to parametrize x2 in terms of u, I could have get something like this (the following was done by hand, just to show my expected result):
Sol.u = z5
Sol.x2 = exp(-sin(z5))
In this case, we don't need the parameter k, thus our parameters would be as follows:
Sol.parameters = [z4, z5, z6, z7]
I would really appreciate your help in here, I hope it's clear enough.
Risposta accettata
Più risposte (1)
Walter Roberson
il 26 Ott 2021
0 voti
No. You asked to solve in terms of u and x2, so the results always have to have u and x2 expressed in terms of constants or independent variables.
2 Commenti
Nicolas Mira Gebauer
il 26 Ott 2021
Walter Roberson
il 26 Ott 2021
syms x1 u x2 x1_d u_d x2_d
vars = [x1;u;x2;x1_d;u_d;x2_d]
eq = [x2_d == 0;
log(x2) + sin(u) == 0]
x2_sol = solve(eq(2), x2)
eq2 = subs(eq(1), x2, x2_sol)
u_sol = solve(eq2, u, 'returnconditions', true)
Categorie
Scopri di più su Programming in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!