Getting the coefficients of a function in Matlab syms

조회 수: 1 (최근 30일)
Teoman Selcuk
Teoman Selcuk 2021년 11월 15일
답변: DGM 2021년 11월 15일
How would I be able to get the Coefficients of the f function down below and get the Expected Output?
Code:
syms a b
f = expand((a+b)^2)
Expected Output:
1 2 1

답변 (1개)

DGM
DGM 2021년 11월 15일
Try
syms a b
f = expand((a+b)^2)
f = 
c = coeffs(f) % if you want a symbolic result
c = 
c = double(c) % if you want a numeric result
c = 1×3
1 2 1

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by