正在加载图片...
f=nt(x^3/sqrt(1-x)’,"a',"b') -dx 值 ATLAB符号函数可让用户用多种方法来操作这些表达式,比如, >>diff( cos(x))% differentiate cos(x)with respect tox > M=sym('la, b: c, d])% create a symbolic matrix M >>determ(M)% find the determinant of the symbolic matrix M ans- 请注意,上面的第一个例子的符号表达式是用单引号以隐含方式定义的。它告诉 MATLAB cos(x)是一个字符串并说明df’cosx’)是一个符号表达式而不是数字表达式;然而在第二个 例子中,用函数sym显式地告诉 MATLAB M=sym('Ia,b;c,d’)是一符号表达式。在 MATLAB可以自己确定变量类型的场合下,通常不要求显式函数sym 正如在第八章所阐述, MATLAB中函数 function argument形式是与 function(' argument') 等价的。其中, function是一个函数, argument是一字符串。例如, MATLAB可以构造dfr cos(x)和dif('’cos(x)’)两者都意味dir(sym’cosx)’)。但第一种形式显然更便于输入。然而, 很多时候sm是必要的。在上述的第二个例子中, >>M=a, b: c, d]% M is a numeric matrix using value of a through d o??Undefine function or variable a >>M=a, b: c, d'% M is a character string, but not a symbolic matrix > M=sym('a, b: c, d]')% M is a symbolic matrixx x dx a b 3 1−  f=int( ' x^3/sqrt(1-x) ' , ' a ' , ' b ' ) MATLAB符号函数可让用户用多种方法来操作这些表达式,比如, >> diff( ' cos(x) ' ) % differentiate cos(x) with respect to x ans= -sin(x) >> M=sym( ' [a,b;c,d] ' ) % create a symbolic matrix M M= [a,b] [c,d] >> determ(M) % find the determinant of the symbolic matrix M ans= a*d-b*c 请注意,上面的第一个例子的符号表达式是用单引号以隐含方式定义的。它告诉MATLAB ' cos(x) ' 是一个字符串并说明diff( ' cosx ' )是一个符号表达式而不是数字表达式;然而在第二个 例子中,用函数sym显式地告诉MATLAB M=sym( ' [a,b;c,d] ' )是一符号表达式。在 MATLAB可以自己确定变量类型的场合下,通常不要求显式函数sym。 正如在第八章所阐述,MATLAB中函数function argument形式是与function( ' argument ' ) 等价的。其中,function是一个函数,argument是一字符串。例如,MATLAB可以构造diff cos(x)和diff( ' cos(x) ' )两者都意味diff (sym ' cos(x) ' )。但第一种形式显然更便于输入。然而, 很多时候sym是必要的。在上述的第二个例子中, >> M=[a,b;c,d] % M is a numeric matrix using value of a through d ???Uundefine function or variable a. >> M= ' [a,b;c,d] ' % M is a character string, but not a symbolic matrix M= [a,b;c,d] >> M=sym( ' [a,b;c,d] ' ) % M is a symbolic matrix M= [a,b] [c,d]
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有