solving a system of nonlinear equations in terms of parameter (essentially rearrangement)

2 visualizaciones (últimos 30 días)
I'm having a trouble solving a system of equations with multiple parameters and unknowns
syms a b c k t p1 p2 v1 v2 x
eqn_x = x == a + ((p2-v2)-(p1-v1))/(2*t*(1-a-b)) + (1-a-b)/2 ;
eqn_p1 = p1 == c - k + (1/3)*(v1-v2) + t*(1-a-b)*(1+(a-b-4*v1-2*v2)/3) ;
eqn_p2 = p2 == c - k + (1/3)*(v2-v1) + t*(1-a-b)*(1+(a-b-4*v2-2*v1)/3) ;
eqn_v1 = v1 == (c - k + (1/3)*t*(1-a-b)*(3+a-b) + t*(2*(x-a)^2 - (1-b-x)^2))/(1+2*t*(1-a-b)) ;
eqn_v2 = v2 == (c - k + (1/3)*t*(1-a-b)*(3+b-a) + t*(2*(1-b-x)^2 - (x-a)^2))/(1+2*t*(1-a-b)) ;
eqns = [eqn_x, eqn_p1, eqn_p2, eqn_v1, eqn_v2] ;
S = solve(eqns, [p1 p2 v1 v2 x]) ;
This is my code, the goal is to get v1 and v2 term rearranged in terms of only a, b, c, k, & t terms.
there are 5 functions and 5 unknowns. though it is not a system of linear equation because v1 and v2 term depends on quadratic function of x, I guess there is a possible rearrangement.
But what I get is p1, p2, v1, v2, x being [0x1 sym]. How do I get those rearrangement?

Respuestas (1)

Torsten
Torsten el 26 de Ag. de 2019
Does this work ?
syms a b c k t x
eqn = x == a + (((c - k + (1/3)*(((c - k + (1/3)*t*(1-a-b)*(3+b-a) + t*(2*(1-b-x)^2 - (x-a)^2))/(1+2*t*(1-a-b)))-((c - k + (1/3)*t*(1-a-b)*(3+a-b) + t*(2*(x-a)^2 - (1-b-x)^2))/(1+2*t*(1-a-b)))) + t*(1-a-b)*(1+(a-b-4*((c - k + (1/3)*t*(1-a-b)*(3+b-a) + t*(2*(1-b-x)^2 - (x-a)^2))/(1+2*t*(1-a-b)))-2*((c - k + (1/3)*t*(1-a-b)*(3+a-b) + t*(2*(x-a)^2 - (1-b-x)^2))/(1+2*t*(1-a-b))))/3))-((c - k + (1/3)*t*(1-a-b)*(3+b-a) + t*(2*(1-b-x)^2 - (x-a)^2))/(1+2*t*(1-a-b))))-((c - k + (1/3)*(((c - k + (1/3)*t*(1-a-b)*(3+a-b) + t*(2*(x-a)^2 - (1-b-x)^2))/(1+2*t*(1-a-b)))-((c - k + (1/3)*t*(1-a-b)*(3+b-a) + t*(2*(1-b-x)^2 - (x-a)^2))/(1+2*t*(1-a-b)))) + t*(1-a-b)*(1+(a-b-4*((c - k + (1/3)*t*(1-a-b)*(3+a-b) + t*(2*(x-a)^2 - (1-b-x)^2))/(1+2*t*(1-a-b)))-2*((c - k + (1/3)*t*(1-a-b)*(3+b-a) + t*(2*(1-b-x)^2 - (x-a)^2))/(1+2*t*(1-a-b))))/3)) -((c - k + (1/3)*t*(1-a-b)*(3+a-b) + t*(2*(x-a)^2 - (1-b-x)^2))/(1+2*t*(1-a-b)))))/(2*t*(1-a-b)) + (1-a-b)/2 ;
S = solve(eqn,x)
  2 comentarios
Seyoung Won
Seyoung Won el 26 de Ag. de 2019
no it doesn't.... and I think mere substitution wouldn't work because even if one put x terms into v_1 and v_2, at the end of substitution v_1 and v_2 are simultaneously determined so I think it's supposed to be solving a system of 5 equations.
But I have no idea where my code went wrong, a b c k t are just parameter values and I have 5 equations for 5 unknowns, x p1 p2 v1 v2
Torsten
Torsten el 26 de Ag. de 2019
Editada: Torsten el 26 de Ag. de 2019
I inserted the expressions for v1 and v2 in p1 and p2 and then inserted v1, v2 and the revised p1 and p2 all in the first equation x == ...
I only inspected this equation superficially, but it seems it is a quadratic equation in x that MATLAB should be able to solve.

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by