symType
説明
例
シンボリック数
シンボリック数を作成し、その型を決定します。
a = sym('3/9');
s = symType(a)
s = "rational"
次に、シンボリック数を配列要素に含めて、シンボリック配列を作成します。各配列要素のシンボリック型を決定します。
B = [-5, a, vpa(a), 1i, pi]; s = symType(B)
s = 1x5 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 = 1x2 string
"equation" "equation"
solve
を使用して、不等式を解きます。'ReturnConditions'
を true
に設定して解を返します。
eqSol = solve([eq1 eq2], 'ReturnConditions', true);
sols = eqSol.conditions
sols =
解のシンボリック型を決定します。
s = symType(sols)
s = "logicalexpression"
入力引数
symObj
— シンボリック オブジェクト
シンボリック数 | シンボリック変数 | シンボリック式 | シンボリック関数 | シンボリック単位
シンボリック オブジェクト。シンボリック数、シンボリック変数、シンボリック式、シンボリック関数またはシンボリック単位として指定します。
出力引数
s
— シンボリック型
string 配列
シンボリック型。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 コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)