solving equation with variables.

조회 수: 21 (최근 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 CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by