Find Coefficient of a Trigonometric Function
조회 수: 4 (최근 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에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!