Find Coefficient of a Trigonometric Function

조회 수: 6 (최근 30일)
ercan duzgun
ercan duzgun 2022년 1월 3일
댓글: ercan duzgun 2022년 1월 7일
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?

답변 (1개)

VIGNESH B S
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)..
  댓글 수: 1
ercan duzgun
ercan duzgun 2022년 1월 7일
Dear @VIGNESH B S thanks for your answer.
I used that function of coeffs. It is in my code , as you can see. However it only find some of the coefficients in my program. I can only find C21 and D21 coefficient. I can't find other coefficient of A21 B21 E21.

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

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by