Multiplying f(x) with f(-x)
조회 수: 5(최근 30일)
I need to write a code that will multiply function f(x) with f(-x)
Function is always inputed by user in form of an array.
coefficients = input('Enter the coefficients of the function with [ ] around them');
example: If user inputs [1 15 7 2] I would want to mutliply with .
Is there any way for this to be doen without writting a tone of code?
Bruno Luong 2022년 4월 23일
편집: Bruno Luong 2022년 4월 23일
For polynomial funtions with coefficients in P, f(x)*f(-x) is a polynomial as well with coefficients Q that can be computed like this
P=[1 15 7 2];
hold on; ezplot(@(x)polyval(P,x).*polyval(P,-x)); ezplot(@(x)polyval(Q,x));