Find Coefficient of a Trigonometric Function
3 次查看(过去 30 天)
显示 更早的评论
I would like to find the coeffienct of the trigonometric function by separated terms. How can I do that?
My codes are :
clear all;close all;clc;
syms h h1 h2 phi12 phi34 l1 l2 l3 l4 l5 l6 a b
x1=h/3-h1*cos(phi12)
y1=(l1^2-l2^2)/(2*a)
z1=h1*sin(phi12)
x2=(-1/2)*(h/3-h2*cos(phi34))-sqrt(3)/2*((l3^2-l4^2)/(2*a))
y2=(sqrt(3)/2)*(h/3-h2*cos(phi34))-1/2*((l3^2-l4^2)/(2*a))
z2=h2*sin(phi34)
P1P2=expand((x1-x2)^2+(y1-y2)^2+(z1-z2)^2-b^2)
[P1P2_c_cosphi34,P1P2_t_cos34]=coeffs(P1P2,cos(phi34)); C21=P1P2_c_cosphi34(2)
[P1P2_c_cosphi12,P1P2_t_cos12]=coeffs(P1P2,cos(phi12)); D21=P1P2_c_cosphi12(2)
I want to make the equation in this form of
Here I want to find the coefficient of A21, B21, C21, D21 and E21. How can I do this symbolically?
0 个评论
回答(1 个)
VIGNESH B S
2022-1-7
syms x
f = 5.*x.^2 + 7.*x + 3
coeffs(f)
Use coeffs function.
Returns x^0 , x^1 .. ,x^n coeffs.
Also works with sin(x) , cos(x)..
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!