how to do polynomial division
조회 수: 51 (최근 30일)
이전 댓글 표시
hi...
i wanna do polynomial divison given numerator=x^5+x^4+x^3 and
denominator=x^3+x+1 ;remainder should be x...how to implement it in matlab..
댓글 수: 2
답변 (4개)
Daniel Baboiu
2011년 11월 3일
You have two choices: 1. Use the Symbolic Math Toolbox 2. Store all coefficients as a vector (including the coefficients which are 0), then use this representation to implement division steps as described below: http://en.wikipedia.org/wiki/Polynomial_long_division
댓글 수: 2
Walter Roberson
2011년 11월 5일
In mathematics, we mentally extract the coefficients in order to do the division.
Andrei Bobrov
2011년 11월 5일
[a,b]=deconv([1 1 1 0 0 0],[1 0 1 1])
add
p1=[1 1 1 0 0 0]
p2=[1 0 1 1]
[a b] = deconv(p1,p2)
syms x
k = cellfun(@(y) y*x.^(numel(y)-1:-1:0).',{a b p2},'un',0)
k = [k{:}]
out = k(1) + k(2)/k(3)
Walter Roberson
2011년 11월 5일
As you have restricted this to symbolic expressions without ever extracting the coefficients (at least not in code you write, even if it gets done "under the hood"), then the solution is to use the MuPAD Standard Library function pdivide
I could offer a very nice and efficient calculation for polynomials up to order 52 where the coefficients are all 0 or 1, if we are allowed to extract the coefficients in the code (which you could stuff in to a subroutine and never look at again), but I gather that efficiency and simplicity are not important for your purposes.
댓글 수: 5
Walter Roberson
2011년 11월 6일
Do you have the symbolic toolbox installed and licensed? If not, then you cannot do what you are asking for, as only the symbolic toolbox hides extracting the coefficients of polynomials.
Maria Maximina
2014년 2월 21일
hi! o have one question for you! i know it is long time ago.. but anyway.. jajaja if u do that operation that you suggested, and you get a vector like:
[a,b,polinom]
what do actually a and b mean??? thanks!
Ahmed J. Abougarair
2022년 11월 18일
syms x y
p = x^3 - x*y^2 + 1;
d = x + y;
[r,q] = polynomialReduce(p,d)
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!