euclid
説明
例
次の 2 つのローラン多項式を作成します。
cfa = [1 3 5 7]; cfb = [1 2]; lpA = laurentPolynomial(Coefficients=cfa,MaxOrder=2); lpB = laurentPolynomial(Coefficients=cfb);
に対し、 によるユークリッド除算を実行します。補助関数 helperPrintLaurent を使用して、各ユークリッド除算の商多項式と剰余多項式を出力します。
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)
各ユークリッド除算について、 であることを確認します。ここで、 と は、それぞれ i 番目の除算の商多項式と剰余多項式です。
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 Division #1: 1 Euclidean Division #2: 1 Euclidean Division #3: 1 Euclidean Division #4: 1
入力引数
ローラン多項式。laurentPolynomial オブジェクトとして指定します。
ローラン多項式。laurentPolynomial オブジェクトとして指定します。
出力引数
拡張機能
C/C++ コード生成
MATLAB® Coder™ を使用して C および C++ コードを生成します。
バージョン履歴
R2021b で導入
MATLAB Command
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.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)