dec = euclid(A,B)
returns an array of structures such that each row of dec corresponds to
the Euclidean division of the Laurent polynomial A by the Laurent
polynomial B:
Perform Euclidean division of by . Use the helper function helperPrintLaurent to print the quotient and remainder polynomials of each Euclidean division.
dec = euclid(lpA,lpB);
numFac = size(dec,1);
for k=1:numFac
q = helperPrintLaurent(dec(k,1).LP);
r = helperPrintLaurent(dec(k,2).LP);
fprintf('Euclidean Division #%d\n',k)
fprintf('Quotient: %s\n',q)
fprintf('Remainder: %s\n \n',r)
end
Euclidean Division #1
Quotient: z^(2) + z + 3
Remainder: + z^(-1)
Euclidean Division #2
Quotient: z^(2) + z + 3.5
Remainder: - 0.5
Euclidean Division #3
Quotient: z^(2) + 0.75*z + 3.5
Remainder: + 0.25*z
Euclidean Division #4
Quotient: 1.125*z^(2) + 0.75*z + 3.5
Remainder: - 0.125*z^(2)
For each Euclidean division, confirm that , where and are the quotient and remainder polynomials, respectively, of the ith division.
for k=1:numFac
q = dec(k,1).LP;
r = dec(k,2).LP;
areEqual = (lpA==lpB*q+r);
fprintf('Euclidean Division #%d: %d\n',k,areEqual)
end
Euclidean algorithm factors, returned as a N-by-2 structure
array, where N ≤ 4 is the number of decompositions. The
ith row of dec contains one Euclidean division
of A by B:
A = B*(dec(i,1).LP) +
dec(i,2).LP
where
dec(i,1).LP is the Laurent polynomial
corresponding to the quotient.
dec(i,2).LP is the Laurent polynomial
corresponding to the remainder.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.