symType
シンボリック オブジェクトの型の決定
説明
例
シンボリック数を作成し、その型を決定します。
a = sym('3/9');
s = symType(a)
s = "rational"
次に、シンボリック数を配列要素に含めて、シンボリック配列を作成します。各配列要素のシンボリック型を決定します。
B = [-5, a, vpa(a), 1i, pi]; s = symType(B)
s = 1×5 string
"integer" "rational" "vpareal" "complex" "constant"
syms
を使用してシンボリック関数 f(x)
を作成します。
syms f(x)
関数の型を決定します。f(x)
は未割り当てのシンボリック関数であるため、そのシンボリック型は "symfun"
です。
s = symType(f)
s = "symfun"
f(x)
に数式を割り当てると、そのシンボリック型が変更されます。
f(x) = x^2; s = symType(f)
s = "expression"
f(x) = x
のシンボリック型とその導関数を確認します。
f(x) = x; s = symType(f)
s = "variable"
s = symType(diff(f))
s = "integer"
不等式の求解時にさまざまなシンボリック オブジェクトの型を決定します。
二次関数を作成します。
syms y(x)
y(x) = 100 - 5*x^2
y(x) =
2 つの不等式を二次関数に設定します。各不等式のシンボリック型を確認します。
eq1 = y(x) > 10; eq2 = x > 2; s = symType([eq1 eq2])
s = 1×2 string
"equation" "equation"
solve
を使用して、不等式を解きます。'ReturnConditions'
を true
に設定して解を返します。
eqSol = solve([eq1 eq2], 'ReturnConditions', true);
sols = eqSol.conditions
sols =
解のシンボリック型を決定します。
s = symType(sols)
s = "logicalexpression"
入力引数
シンボリック オブジェクト。シンボリック数、シンボリック変数、シンボリック式、シンボリック関数またはシンボリック単位として指定します。
出力引数
シンボリック型。string 配列として返されます。次の表に、さまざまなシンボリック オブジェクトの出力値を示します。
出力 | 説明 | 入力の例 |
---|---|---|
"integer" | シンボリック整数 | symType(sym('-1')) |
"rational" | シンボリック有理数 | symType(sym('1/2')) |
"vpareal" | シンボリックな可変精度の浮動小数点実数値 | symType([sym('1.5') vpa('3/2')]) |
"complex" | シンボリック複素数 | symType(sym('1+2i')) |
"constant" | シンボリック数学定数 | symType(sym([pi catalan])) |
"variable" | シンボリック変数 | syms x; symType(x) |
"symfun" | 未割り当てのシンボリック関数 | syms f(x); symType(f) |
"expression" | シンボリック式 | syms x; symType(sqrt(x)) |
"equation" | シンボリックな方程式および不等式 | syms x; symType(x>=0) |
"unit" | シンボリック単位 | symType(symunit('meter')) |
"logicalexpression" | シンボリックな論理式 | syms x y; symType(x|y) |
"logicalconstant" | シンボリック論理定数 | symType([symtrue symfalse]) |
"unsupported" | symType でサポートされていないシンボリック オブジェクト |
バージョン履歴
R2019a で導入
参考
sym
| syms
| symfun
| isSymType
| symFunType
| hasSymType
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)