matlab subs命令,Matlab中subs函数
導(dǎo)航:網(wǎng)站首頁 >
Matlab中subs函數(shù)
時間:2019-2-17
Matlab中subs函數(shù)
syms x y;
subs(x*y, {x, y}, {[0 1; -1 0], [1 -1; -2 1]})
x與y是'*',不是'.*'啊,為什么會得到這個結(jié)果
ans = 0 -1
2 0
相關(guān)問題:
匿名網(wǎng)友:
這里subs的替換換就是元素替換,沒有矩陣替換后執(zhí)行矩陣運算
你要進(jìn)行矩陣運算可以這樣寫
>> x=sym([0 1;-1 0]);
>> y=sym([1 -1;-2 1]);
>> x*y
ans =
[ -2,1]
[ -1,1]
再問: 我知道這些,我的問題是為什么會出現(xiàn)這個結(jié)果?
再答: subs的替換就是元素替換,就算是帶入矩陣也是執(zhí)行元素運算,subs程序就是這樣寫的啊 SUBS Symbolic substitution. SUBS(S) replaces all the variables in the symbolic expression S with values obtained from the calling function, or the MATLAB workspace. SUBS(S,NEW) replaces the free symbolic variable in S with NEW. SUBS(S,OLD,NEW) replaces OLD with NEW in the symbolic expression S. OLD is a symbolic variable, a string representing a variable name, or a string (quoted) expression. NEW is a symbolic or numeric variable or expression. If OLD and NEW are vectors or arrays of the same size, each element of OLD is replaced by the corresponding element of NEW. If S and OLD are scalars and NEW is an array or cell array, the scalars are expanded to produce an array result. If NEW is a cell array of numeric matrices, the substitutions are performed elementwise (i.e., subs(x*y,{x,y},{A,B}) returns A.*B when A and B are numeric). If SUBS(S,OLD,NEW) does not change S, then SUBS(S,NEW,OLD) is tried. This provides backwards compatibility with previous versions and eliminates the need to remember the order of the arguments. SUBS(S,OLD,NEW,0) does not switch the arguments if S does not change. Multiple Substitutions: subs(cos(a)+sin(b),{a,b},[sym('alpha'),2]) or subs(cos(a)+sin(b),{a,b},{sym('alpha'),2}) returns cos(alpha)+sin(2) Scalar Expansion Case: subs(exp(a*t),'a',-magic(2)) returns [ exp(-t), exp(-3*t)] [ exp(-4*t), exp(-2*t)] Multiple Scalar Expansion: subs(x*y,{x,y},{[0 1;-1 0],[1 -1;-2 1]}) returns [ 0, -1] [ 2, 0]
大家還關(guān)注:
什么是matlab subs函數(shù)?
2個答案??提問時間: 2018-03-31
回答:matlab中subs()是符號計算函數(shù),詳細(xì)用法可以在Matlab的Command Windows輸入:help subs。subs()函數(shù)表示將符號表達(dá)式中的某些符號變量替換為指定的新的變...2018-4-1
Matlab中subs函數(shù)
5個答案??提問時間: 2011-09-28??49個贊
問題說明:syms x y; subs(x*y, {x, y}, {[0 1; -1 0], [1 -1; -2 1]}) x與y是'*',不是'.*'啊,為什么...
回答:這里subs的替換換就是元素替換,沒有矩陣替換后執(zhí)行矩陣運算 你要進(jìn)行矩陣運算可以這樣寫>> x=sym([0 1;-1 0]);>> y=sym([1 -1;-2 1]);>> x*y ans = [ -2, 1] [ -1, 1]2011-9-28
matlab subs函數(shù)
3個答案??提問時間: 2012-08-31??718個贊
問題說明:yy=subs(y,x); 最后一行的subs的作用是什么,subs函數(shù)應(yīng)該怎樣使用?謝謝...
回答:matlab中subs()是符號計算函數(shù),表示將符號表達(dá)式中的某些符號變量替換為指定的新的變量,常用調(diào)用方式為:subs(S,OLD,NEW) 表示將符號表達(dá)式S中的符號變量...2012-8-31
關(guān)于MATLAB中subs()函數(shù)
2個答案??提問時間: 2013-03-26??5個贊
問題說明:最后用subs()函數(shù)來將矩陣A中的所有的符號變量X1到XM,都替換成已知...
回答:因為你說的比較籠統(tǒng),我只能大概提供幾個思路。當(dāng)否自行判斷1 在替換之前進(jìn)行簡化,跟tybtch兄是一個意見2 在整個推導(dǎo)過程中能否先做替換?3 如果是推倒完之后要做...2013-3-27
matlab中的subs函數(shù)直接subs(F)是什么意思啊?誰能給我舉個具體的...
2個答案??提問時間: 2018-11-17??31個贊
問題說明:在求subs。 請問為什么要在求subs啊,不是已經(jīng)是數(shù)值了么?怎么還要替代...
回答:符號運算中,所有的字符都會定義為符號,數(shù)字也可以定義為符號 subs(F)函數(shù)式將F的變量具體的內(nèi)容帶入表達(dá)式中得到數(shù)值解。例如 F= ax^2+by^2+cz^2 [x;y;z] = [1;2;3];...2018-11-18
Matlab中subs函數(shù)的使用-
1個答案??提問時間: 2013-06-03??4個贊
問題說明:plot(xt,dxt)其中四次用到subs函數(shù),請高手指點其中的意義!
回答:R = subs(S) replaces all occurrences of variables in the symbolic expression S with values obtained from the calling
問題推薦
總結(jié)
以上是生活随笔為你收集整理的matlab subs命令,Matlab中subs函数的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 一个简单的例子由易到难理解动态规划
- 下一篇: linux操作系统课程设计总结,操作系统