solving equation with variables.

19 ビュー (過去 30 日間)
Farzaneh
Farzaneh 2014 年 3 月 26 日
回答済み: Walter Roberson 2014 年 3 月 26 日
I wanna solve this equation for K_1^2/w^2, when A=0
A=-(E*G*k_1^4 + k_1^2*r^2*w^2 - E*R*k_1^2*w^2 - e*m*r^2*w^4 + E^2*R*l^2*m*w^4 + E*R*e*m*w^4 - E^2*G*k_1^2*l^2*m*w^2 - E*G*e*k_1^2*m*w^2)/(G*e)

回答 (2 件)

Star Strider
Star Strider 2014 年 3 月 26 日
May not be the most efficient code, but it seems to work:
syms E G R k_1 r w e m l a b
assume( (k_1^2/w^2) > 0)
assumeAlso( k_1 > 0 )
assumeAlso( w > 0 )
% Equation:
A=-(E*G*k_1^4 + k_1^2*r^2*w^2 - E*R*k_1^2*w^2 - e*m*r^2*w^4 + E^2*R*l^2*m*w^4 + E*R*e*m*w^4 - E^2*G*k_1^2*l^2*m*w^2 - E*G*e*k_1^2*m*w^2)/(G*e);
% Substitute ‘a’ for ‘k_1^2’ and ‘b’ for ‘w^2’
B = subs(A == 0, {k_1^2, w^2, k_1^4, w^4}, {a, b, a^2, b^2})
B = simplify(collect(expand(B)))
% Solve for ‘a’ = ‘k_1^2’
a = solve(B, a);
% Factor out ‘b’ = ‘w^2’ (not necessary but helpful)
a = collect(a, b);
% ‘c’ = a/b = k_1^2/w^2
c = simplify(collect(a/b))

Walter Roberson
Walter Roberson 2014 年 3 月 26 日
syms E G R k_1 r w e m l a b B
A = -(E*G*k_1^4 + k_1^2*r^2*w^2 - E*R*k_1^2*w^2 - e*m*r^2*w^4 + E^2*R*l^2*m*w^4 + E*R*e*m*w^4 - E^2*G*k_1^2*l^2*m*w^2 - E*G*e*k_1^2*m*w^2)/(G*e);
Bsol = simplify( solve( subs(A, w, sqrt(B/k_1^2)), B) );
Bsol will be k_1^2 / w^2
there will be two solutions (i.e. quadratic form)

カテゴリ

Help Center および File ExchangeNumeric Solvers についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by