How to solve a simple symbolic identity?

조회 수: 2 (최근 30일)
DH
DH 2023년 5월 30일
답변: DH 2023년 5월 30일
I have the following identity.
The solution is .
I wrote the following code.
syms w0 a b t m F0;
eqn = 2*b*w0*cos(w0*t) - 2*a*w0*sin(w0*t) == (F0*cos(w0*t))/m;
sol = solve(eqn, [a b])
sol = struct with fields:
a: -(F0*cos(t*w0))/(2*m*w0*sin(t*w0)) b: 0
The sol is not what I want to get.
Could you tell me how to get the correct a and b, i.e., ?

채택된 답변

DH
DH 2023년 5월 30일
Thank you VBBV.
Based on your reply, I wrote the following code:
syms w0 a b t m F0;
eqn = 2*b*w0*cos(w0*t) - 2*a*w0*sin(w0*t) == (F0*cos(w0*t))/m;
eq1 = subs(eqn, t, 0.5);
eq2 = subs(eqn, t, 0.6);
sys_eqn = [eq1 eq2];
sol = solve(sys_eqn, [a b])
sol = struct with fields:
a: 0 b: F0/(2*m*w0)

추가 답변 (1개)

VBBV
VBBV 2023년 5월 30일
syms w0 a b t m F0
eqn = 2*b*w0*cos(w0*t) - 2*a*w0*sin(w0*t) == (F0*cos(w0*t))/m;
sol = solve(eqn, [b])
sol = 
b = subs(sol,t,0)
b = 
  댓글 수: 1
VBBV
VBBV 2023년 5월 30일
편집: VBBV 2023년 5월 30일
Solve for b variable and substitute t as zero, since you have only one equation, you can solve for only one variable. The solution to a doesnt exist for t = 0.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

태그

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by