is there a way to obtain F(-x) polynomial

2 views (last 30 days)
syms x
%if i have
% f is the coeffents of the polynomial
f=[2 43 12];
%F(x) is the polynomial of (+x)
F(x)=poly2sym(f,x)
%F(-x) the poly nomial of(-x)
F(-x)=???
% is there a way to obtain F(-x)?
  3 Comments
Torsten
Torsten on 14 May 2022
You define a new symbolic function G as G(x) = F(-x). That's what F(-x) means.

Sign in to comment.

Accepted Answer

Voss
Voss on 14 May 2022
Here's a way to do it by operating on the coefficients f rather than the symbolic F(x).
Realize that
  • , n even
  • , n odd
Therefore, you can obtain the coefficients of F(-x) from the cofficients of F(x) by negating the coefficients of the odd powers of x:
syms x
f=[2 43 12];
%F(x) is the polynomial of (+x)
F(x)=poly2sym(f,x)
F(x) = 
%F_(x) is the polynomial of (-x)
f_ = f;
f_(end-1:-2:1) = -f(end-1:-2:1);
F_(x) = poly2sym(f_,x)
F_(x) = 
  1 Comment
Voss
Voss on 14 May 2022
An alternative (maybe more intuitive) way to do the same (multiplying each coefficient by (-1)^n, where n is the corresponding power of x):
syms x
f=[2 43 12];
%F(x) is the polynomial of (+x)
F(x)=poly2sym(f,x)
F(x) = 
%F_(x) is the polynomial of (-x)
f_ = f.*(-1).^(numel(f)-1:-1:0);
F_(x) = poly2sym(f_,x)
F_(x) = 

Sign in to comment.

More Answers (1)

Sam Chak
Sam Chak on 14 May 2022
Alternatively, the same you've got F(x).
H(x) = poly2sym(f, -x)
  2 Comments
Sam Chak
Sam Chak on 14 May 2022
My apologies. I quickly ran it from Octave. I was not aware that it doesn't work on MATLAB. Follow @Torsten's and @_'s methods.

Sign in to comment.

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!