フィルターのクリア

Find coefficients after rearranging harmonic terms

2 ビュー (過去 30 日間)
T S Singh
T S Singh 2019 年 2 月 6 日
回答済み: Star Strider 2019 年 2 月 6 日
I am trying to find the coefficients of sin(w*t), cos (w*t), sin(2*w*t) and cos(2*w*t) in the expression 'f'
Here is the code
clear all
close all
clc
syms A11 A12 A21 A22 B1 B2
syms A0 B0 A1 B1 C1 D1
syms w t
syms Ps Pc
syms km
th=A0*cos(w*t)+B0*sin(w*t)+B1*cos(2*w*t)+B1+C1*sin(2*w*t);
thd=diff(th,t);
thdd=diff(th,t,2);
f=thdd-(A21-A22*(1+km*(sin(w*t)*Pc+cos(w*t)*Ps)))*thd-(A22*w*km*(cos(w*t)*Pc-sin(w*t)*Ps))*thd+B1*w*cos(w*t);
But I am finding it difficult to rearrage the expression, interms of sin(w*t), cos (w*t), sin(2*w*t) and cos(2*w*t)
[C,T] = coeffs(f,{sin(w*t),cos(w*t),cos(2*w*t),sin(2*w*t)})
Any help.
Thank You

採用された回答

Star Strider
Star Strider 2019 年 2 月 6 日
Try this:
syms A11 A12 A21 A22 B1 B2 A0 B0 A1 B1 C1 D1 w t Ps Pc km
th(t) = A0*cos(w*t)+B0*sin(w*t)+B1*cos(2*w*t)+B1+C1*sin(2*w*t);
thd=diff(th,t);
thdd=diff(th,t,2);
f=thdd-(A21-A22*(1+km*(sin(w*t)*Pc+cos(w*t)*Ps)))*thd-(A22*w*km*(cos(w*t)*Pc-sin(w*t)*Ps))*thd+B1*w*cos(w*t);
fc = collect(f, [sin(w*t) sin(2*t*w) cos(w*t) cos(2*t*w)]) % Collected Terms
[fcc,T] = coeffs(f, [sin(w*t) sin(2*t*w) cos(w*t) cos(2*t*w)]) % Coefficients & Terms
produces:
fc(t) =
(- A0*A22*Ps*km*w^2 - A0*A22*Pc*km*w)*sin(t*w)^2 + (- 2*A22*B1*Ps*km*w^2 - 2*A22*B1*Pc*km*w)*sin(t*w)*sin(2*t*w) + (A22*B0*Pc*km*w - A0*A22*Ps*km*w + A0*A22*Pc*km*w^2 + A22*B0*Ps*km*w^2)*sin(t*w)*cos(t*w) + (2*A22*C1*Ps*km*w^2 + 2*A22*C1*Pc*km*w)*sin(t*w)*cos(2*t*w) + (- B0*w^2 + A0*(A21 - A22)*w)*sin(t*w) + (2*A22*B1*Pc*km*w^2 - 2*A22*B1*Ps*km*w)*sin(2*t*w)*cos(t*w) + (- 4*C1*w^2 + 2*B1*(A21 - A22)*w)*sin(2*t*w) + (- A22*B0*Pc*km*w^2 + A22*B0*Ps*km*w)*cos(t*w)^2 + (- 2*A22*C1*Pc*km*w^2 + 2*A22*C1*Ps*km*w)*cos(t*w)*cos(2*t*w) + (B1*w - A0*w^2 - B0*w*(A21 - A22))*cos(t*w) + (- 4*B1*w^2 - 2*C1*(A21 - A22)*w)*cos(2*t*w)
fcc(t) =
[ - A0*A22*Ps*km*w^2 - A0*A22*Pc*km*w, - 2*A22*B1*Ps*km*w^2 - 2*A22*B1*Pc*km*w, A22*B0*Pc*km*w - A0*A22*Ps*km*w + A0*A22*Pc*km*w^2 + A22*B0*Ps*km*w^2, 2*A22*C1*Ps*km*w^2 + 2*A22*C1*Pc*km*w, - B0*w^2 + A0*(A21 - A22)*w, 2*A22*B1*Pc*km*w^2 - 2*A22*B1*Ps*km*w, - 4*C1*w^2 + 2*B1*(A21 - A22)*w, - A22*B0*Pc*km*w^2 + A22*B0*Ps*km*w, - 2*A22*C1*Pc*km*w^2 + 2*A22*C1*Ps*km*w, B1*w - A0*w^2 - B0*w*(A21 - A22), - 4*B1*w^2 - 2*C1*(A21 - A22)*w]
T(t) =
[ sin(t*w)^2, sin(t*w)*sin(2*t*w), cos(t*w)*sin(t*w), cos(2*t*w)*sin(t*w), sin(t*w), cos(t*w)*sin(2*t*w), sin(2*t*w), cos(t*w)^2, cos(t*w)*cos(2*t*w), cos(t*w), cos(2*t*w)]

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by