• 沒有找到結果。

符號表示式

N/A
N/A
Protected

Academic year: 2022

Share "符號表示式"

Copied!
83
0
0

加載中.... (立即查看全文)

全文

(1)

MATLAB 7 在工程上的應用

第 10 章

MATLAB 中的符號處理程序

(2)

本章中包含符號數學工具箱,將介紹

• 符號代數。

• 求解代數方程式以及超越方程式的符號方法。

• 求解常微分方程式的符號方法。

• 符號微積分,包含了積分、微分、極限,以及級數。

• 拉氏轉換。

• 某些線性代數的主題,包含求解行列式值、反矩陣,以 及特徵值的符號方法。

(3)

當讀者完成本章的學習,則具備使用MATLAB進行下列事項 的能力

• 建立符號表示式並且以代數的方式操作。

• 求解代數方程式以及超越方程式的符號解。

• 進行符號微分與積分。

• 以符號方法計算極限與級數。

• 求出常微分方程式的符號解。

• 求出拉氏轉換。

• 進行符號線性代數運算,包含求出行列式值、反矩陣,

以及特徵值的算式。

(4)

函數 sym 可以用來建立 MATLAB 中的「符號物件」。

如果 sym 的輸入引數是一個字串,則所得到的結果是一個符 號的數字或者變數;如果此函數的輸入引數是一個數值純量 或者是一個矩陣,則所得到的結果是一個給定數值的符號表 示式。

舉例來說,輸入x = sym(’x’)會建立出名稱為 x 的符號變數,

並且輸入y = sym(’y’)則會建立出名稱為 y 的符號變數。

輸入x = sym(’x’,’real’)則是告訴 MATLAB ,假設 x 是一個實 數。若是輸入 x = sym(’x’,’unreal’)則是告訴 MATLAB 假設 x 不是一個實數。

(5)

syms 這個函數則是能夠讓你將超過一個以上的敘述 放入單一個敘述之中。

舉例來說,輸入syms x 等效於輸入 x = sym(’x’),並 且輸入 syms x y u v 能夠建立x

yu,以及 v 這四

個符號變數。

(6)

你可以使用sym這個函數來建立符號常數,方式是藉由 使用數值來當作引數。

例如,輸入 pi = sym(’pi’)

fraction = sym(’1/3’) 以及

sqroot2 = sym(’sqrt(2)’)

可以建立出避免數值例如 pi, 1/3以及 等浮點數所繼

承而來的近似。

2

(7)

符號表示式

你可以在算式中使用符號變數或者再將符號變數當作 函數的引數使用。使用的方式就好像在進行數值運算 的時候使用運算子 + - * / ^以及內建函數的方式一樣。

例如,我們輸入

>>syms x y

>>s = x + y;

>>r = sqrt(x^2 + y^2);

則可以建立符號變數s 以及 r。其中s = x + y 以及 r = sqrt(x^2 + y^2)這兩項則是符號表式的例子。

(8)

而在 MATLAB 中所使用的向量以及矩陣的標記方法,

對於符號變數也一併適用。例如,你可以使用下列的對 話來建立符號矩陣 A :

>>n = 3;

>>syms x;

>>A = x.^((0:n)’*(0:n)) A =

[ 1, 1, 1, 1]

[ 1, x, x^2, x^3]

[ 1, x^2, x^4, x^6]

[ 1, x^3, x^6, x^9]

(9)

函數collect(E)可以收集算式 E 中相同次方的係數。如果具

有超過一個以上的變數,則要使用選擇性的形式collect(E,v),

同時收集具有相同次方 v 的係數。

>>syms x y

>>E = (x-5)^2+(y-3)^2;

>>collect(E) ans =

x^2-10*x+25+(y-3)^2

>>collect(E,y) ans =

y^2-6*y+(x-5)^2+9

(10)

而expand 以及 simplify 函數的使用方式如下。

>>syms x y

>>expand((x+y)^2) % applies algebra rules ans =

x^2+2*x*y+y^2

>>expand(sin(x+y)) % applies trig identities ans =

sin(x)*cos(y)+cos(x)*sin(y)

>>simplify(6*((sin(x))^2+(cos(x))^2)) % applies another trig identity

ans = 6

(11)

factor 函數可以進行因式分解。

>>syms x y

>>factor(x^2-1) ans =

(x-1)*(x+1)

(12)

subs(E,old,new)可以將算式 E 中 old 的部分以 new取代,其中 old 這個部分可以是符號變數或者是符號表示式,並且 new 這 個部分可以是符號變數、符號表式、矩陣、數值的值,或者 是數值的矩陣。

例如,

>>syms x y

>>E = x^2+6*x+7;

>>F = subs(E,x,y) F =

y^2+6*y+7

(13)

若要告訴 MATLAB,函數 f 是變數 t 的函數,則要輸入f = sym(’f(t)’)。結果,f 的行為會像是 t 的函數,並且你可以使用 工具箱指令來操作這個函數。

舉例來說,要建立一個新的函數 g(t) = f (t + 2) - f (t) ,則對話 如下

>>syms t

>>f = sym(’f(t)’);

>>g = subs(f, t, t+2)-f g =

f(t+2)-f(t)

一旦某一個函式被定義為f (t) ,則函數g (t)也同時定義完成。

(14)

使用subs以及double這兩個函數以數值的方式計算算式。使用 subs(E,old,new)以數值new 來取代算式 E 中的old。所得到的 結果類別是雙倍浮點數。

例如,

>>syms x

>>E = x^2+6*x+7;

>>G = subs(E,x,2) G =

23

>>class(G) ans =

double

(15)

MATLAB 函數 ezplot(E)可以產生符號表式 E 的圖形,也 就是具有一個變數的函數圖形。

預設的自變數的範圍落在區間 [-2p, 2p] 之間,除非此區 間具有奇異點。

另一個選擇性的形式為 ezplot(E,[xmin xmax]),可以產生 範圍xmin 到 xmax。

(16)

圖10.1–1 使用ezplot函數所產生的 E = x 2 - 6x + 7 的函數圖形。

(17)

優先順序

MATLAB並不一定將算式依照我們一般所使用的形式編排。

例如,MATLAB也許會求出-c+b這種形式的答案,而一般的 時候我們通常會寫成 b-c。

所以必須要將MATLAB使用優先順序牢記在心,以免誤解

(請參考課本第1-8~1-9頁對於優先權的相關討論)。

MATLAB常常也會將結果表示成為1/a*b這樣的形式,而對 於這個形式我們通常會寫成 b/a。

(18)

瞭解問題測試

T10.1-1 Given the expression:

and

A. Find product E1E2 and express it in its simplest form

B. Find the quotient E1/E2 and express it in its simplest form

C. Evaluate the sum E1 + E2 at x = 7.1 in symbolic form and in numeric form.

3 2

1 15 75 125

Exxx

2

2 ( 5) 20

Ex   x

(19)

瞭解問題測試

T10.1-1 The sessions are:

(a)

syms x

E1 = x^3-15*x^2+75*x-125;

E2 = (x+5)^2-20*x;

S1 = E1*E2;

factor(S1)

ans =

(x-5)^5

S2 = E1/E2;

simplify(S2)

ans =

x-5

S3 = E1+E2;

simplify(S2)

ans =

x-5

S3 = E1+E2;

G = sym(subs(S3,x,7.1))

G =

7696088813222736*2^(-49)

G = simplify(G)

G =

481005550826421/3518437208 8832

H = double(G)

H =

13.6710

(20)

solve 函數

有三種使用solve函數的方式。

例如,要求解方程式 x + 5 = 0,一種方式是

>>eq1 = ’x+5=0’;

>>solve(eq1) ans =

-5

而第二種方式就是

>>solve(’x+5=0’) ans =

-5

代數與超函數方程式

(21)

solve 函數(承上頁)

第三種方式是

>>syms x

>>solve(x+5) ans =

-5

你可以使用以下的方法將結果儲存於命名的變數當中:

>>syms x

>>x = solve(x+5) x =

-5

(22)

求解方程式 e2x + 3ex = 54的對話為

>>solve(’exp(2*x)+3*exp(x)=54’) ans =

[ log(-9)]

[ log(6)]

(23)

其他的範例:

>>eq2 = ’y^2+3*y+2=0’;

>>solve(eq2) ans =

[-2]

[-1]

>>eq3 = ’x^2+9*y^4=0’;

>>solve(eq3) %Note that x is presumed to be the unknown variable

ans =

[ 3*i*y^2]

[-3*i*y^2]

(在對話開始前 x 被認定是未知的變數)

(24)

當算式中具有超過一個以上的變數的時候,MATLAB 會將 字母順序最接近於 x 的變數當作找到的變數。你可以使用 語法solve(E,’v’)來指定你想要的變數,此語法指定 v 是解的 變數。

(25)

>>solve(‘b^2+8*c+2*b=0’) ans =

- b^2/8 - b/4

>> solve(‘b^2+8*c+2*b=0’, ‘b’) ans =

- (1 - 8*c)^(1/2) - 1 (1 - 8*c)^(1/2) – 1 Also,

>>[x, y] = solve(eq1, eq2)

>>x = -5 -5 y =

-2 -1

10-22

(26)

>>eq4 = ’6*x+2*y=14’;

>>eq5 = ’3*x+7*y=31’;

>>solve(eq4,eq5)

ans =

x: [1x1 sym]

y: [1x1 sym]

>> y=ans.y

y =

4

>> x=ans.x

x =

1

>>[x,y]=solve(eq4,eq5)

x =

1

y =

4

>> s=solve(eq4,eq5)

>> s.x

ans =

1

>> s.y

ans =

4

(27)

瞭解問題測試

T10.2-1 The session is:

syms x

solve(sqrt(1-x^2)-x)

ans =

1/2*2^(1/2)

T10.2-2 The session is:

S = solve(0x+6*y=a0,02*x-3*y=90);

S.x

ans =

18/5+1/5*a

S.y

ans =

-3/5+2/15*a

USE matlab to solve the equation

1 x2x

USE matlab to solve the equation set x+6y=a, 2x-3y=9 for x and y in terms of the parameter a.

(28)

Ex.10.2.1兩圓交點

To find the intersection points of two circles. The first circle has a radius of 2 and is centered at x = 3, y=5.

The second circle has a radius b and is centered at x=5, y = 3.

A. Find the (x, y) coordinates of the intersection points in terms of the parameter b.

B. Evaluate the solution for the case where b = 3

0.5

(29)

圖10.2–1 兩個圓的交點。

(30)

These equations:

clear all;clc;

syms x y b

eq01='(x-3)^2+(y-5)^2=4';

eq02 ='(x-5)^2+(y-3)^2=b^2';

s= solve(eq01, eq02);

s.x

s.y

subs(s.x, b, sqrt(3))

subs(s.y, b, sqrt(3))

2 2

(x  3)  (y 5)  4

2 2 2

(x 5) (y 3) b

(31)

The solution for the x coordinates of the intersection points is

For y coordinate is S.y

(b)

>>subs(S.x, b, sqrt(3))

Ans=

4.9820

3.2680

2 2 4

9 1 1

16 24

2 8 8

x   b   b b

(32)

瞭解問題測試

T10.2-3 After the session shown at the end of Example 10.2-1, type

subs(S.y,b,sqrt(3))

ans =

4.7320

3.0180

(33)

Ex 10.2.2 Positioning a Robot Arm

Figure shows a robot arm having two joints and two links. The angles of rotation of the motor at the joints are 1 and 2. From trigonometry we can derive the following expressions for the (x, y) coordinates of the hand:

x= L1cos1 + L2cos(1 + 2) y= L1sin1 + L2sin(1 + 2)

Suppose that the link lengths are L1 = 4 ft and L2 = 3 ft.

A. compute the motor angles required to position the hand at x=6 ft and y=2 ft.

B. It is desired to move the hand along the straight line where x is constant at 6 ft and y varies from y = 0.1 to y =3.6 ft. Obtain a

plot of the required motor angles as a function of y.

(34)

一個具有兩個連桿以及兩個關節的機器手臂。

(35)

>>S = solve('4*cos(th1)+3*cos(th1+th2)=6',...

'4*sin(th1)+3*sin(th1+th2)=2')

S =

th1:[2x1 sym]

th2:[2x1 sym]

>>double(S.th1)*(180/pi) % convert from radians to degrees

ans =

-3.2981

40.1680

>>double(S.th2)*(180/pi) % convert from radians to degrees

ans =

51.3178

-51.3178

(36)

S = solve('4*cos(th1)+3*cos(th1+th2)=6',...

'4*sin(th1)+3*sin(th1+th2)=y', 'th1','th2');

yr = [1:0.1:3.6];

th1r = [subs(S.th1(1),'y',yr);subs(s.th1(2),'y',yr)];

th2r = [subs(S.th2(1),'y',yr);subs(s.th2(2),'y',yr)];

th1d = (180/pi)*th1r;

th2d = (180/pi)*th2r;

subplot(2,1,1)

plot(yr,th1d,2,-3.2981,'x',2,40.168,'o'),xlabel('y(feet)'),...

ylabel(‘Theta1 (degrees)’)

subplot(2,1,2)

plot(yr,th2d,2,-51.3178,'o',2,51.3178,'x'),xlabel('y(feet)'),...

ylabel('Theta2 (degrees)')

(37)

圖10.2–3 機器手臂的手部沿著一條垂直的直線運動,機器手臂馬 達角度的圖形。

(38)

以diff函數進行微分

>>syms n x y

>>diff(x^n) ans =

x^n*n/x

>>simplify(ans) ans =

x^(n-1)*n

>>diff(log(x)) ans =

1/x

>>diff((sin(x))^2) ans =

2*sin(x)*cos(x)

(39)

如果算式包含了超過一個以上的變數,除非指明其他的狀況,

否則 diff 函數會針對 x 進行計算,或者最接近於 x 的變數來 進行微分。當具有超過一個以上的變數的時候, diff函數會計 算偏微分。

例如,

>>diff(sin(x*y)) ans =

cos(x*y)*y

(40)

函數 diff(E,v)會傳回算式 E 對於變數 v 的微分。

>>syms x y

>>diff(x*sin(x*y),y) ans =

x^2*cos(x*y)

(41)

函數 diff(E,n) 則會傳回算式 E 對於預設的自變數的第 n 階 微分。

>>syms x

>>diff(x^3,2) ans =

6*x

(42)

函數 diff(E,v,n) 則會傳回算式 E 對於變數 v 的第 n 階微分。

>>syms x y

>>diff(x*sin(x*y),y,2) ans =

-x^3*sin(x*y)

(43)

Ex10.3.1越過”綠色怪物”牆的棒球軌跡

The Green Monster is a wall 37 ft heigh in left field at Fenway Park Boston. The wall is 310 ft from home plate down the left- field line. Assuming that the batter hits the ball 4 ft above the ground, and neglecting air resistance, determine the minimum speed the batter must gave to the ball to hit it over the Green

Monster. In addition, find the angle at which the ball must be hit.

Thus

When x=d and y=h, g=32.2 ft/sec2 Which can solve

( ) ( o cos )

x t v t

2

( ) ( sin )

2 o

y t   gt v t

2

2 2

( ) ( ) ( ) tan 2 ocos

g x t

y t x t

v

  2 2 2 tan

2 ocos

g d

h h

v

 

2

vo 2 2

2 cos2 ( tan )

o

g d

v d h

(44)

Because v0 > 0, minimizing is equivalently to minimizing v0. Note also that gd2/2 ia a multiplicative factor in the expression for . Thus the minimizing value of  is independent of g and can be found by minimizing the function

Thus derivative df/d and solve the equation df/d =0 for .

2

vo

2

vo

2

1

cos ( tan ) f d h

(45)

圖10.3–1 超越綠色怪物的棒球軌跡。

(46)

syms d g h th

f = 1/((cos(th))^2)*(d*tan(th)-h));

dfdth=diff(f,th);

thmin = solve(dfdth, th);

thmin = subs(thmin, (d,h),(310,33))

thmin=

0.8384

-0.7324

d2f/dth2

(47)

>>second = diff(f,2,th); % This is the second derivative.

>>second = subs(second,{th,d,h},{thmin(1),310,33})

second =

0.0321

>>v2 = (g*d^2/2)*f;

>>v2min = subs(v2,{d,h,g},{310,33,32.2});

>>vmin = sqrt(v2min);

>>vmin =

double(subs(vmin(1),{th,d,h,g},{thmin(1),310,33,32.2}))

vmin =

105.3613

(48)

瞭解問題測試

T10.3-1 The session is:

syms x

E = diff(sinh(3*x)*cosh(5*x));

subs(E,x,0.2)

ans =

9.2288

T10.3-2 The session is:

syms x y

diff(5*cosh(2*x)*log(4*y),y)

ans =

5*cosh(2*x)/y

Given that

y=sinh(3x)cosh(5x),find dy/dx at x=0.2

Given that z=5cos(2x)ln(4y)

,find z/y

(49)

使用int函數進行積分 使用函數 2x 來當作例子

>>syms x

>>int(2*x) ans =

x^2

(50)

函數 int(E) 會傳回算式 E 對於預設的自變數的積分。

>>syms n x y

>>int(x^n) ans =

x^(n+1)/(n+1)

>>int(1/x) ans =

log(x)

>>int(cos(x)) ans =

sin(x)

>>int(sin(y)) ans =

-cos(y)

(51)

int(E,v)這個形式會傳回算式 E 對於變數 v 所積分的結果。

>>syms n x

>>int(x^n,n) ans =

1/log(x)*x^n

(52)

函數int(E,a,b)這個形式則會傳回算式 E 對於預設自變數在 區間 [a, b] 之內的積分,其中 a 以及 b 是數值。

>>syms x

>>int(x^2,2,5) ans =

39

(53)

函數int(E,v,a,b)則會傳回算式E對於變數 v 在區間 [a, b]

之內的積分,其中 a 以及 b 是數值。

>>syms x y

>>int(x*y^2,y,0,5) ans =

125*x/3

(54)

函數int(E,m,n)傳回算式 E 對於預設自變數在區間 [m, n] 之 內的積分,其中 m 以及 n 是符號表示式。

>>syms t x

>>int(x,1,t) ans =

1/2*t^2-1/2 int(sin(x),t,exp(t)) ans =

-cos(exp(t)) + cos(t)

(55)

下列的對話是一個無法找到積分的例子。其不定積分實際 上是存在的,但若是積分的界限範圍包含奇異點x = 1 的話,

則其定積分並不存在。

>>syms x

>>int(1/(x-1)) ans =

log(x-1)

>>int(1/(x-1),0,2) ans =

NaN

(56)

瞭解問題測試

T10.3-3 The session is:

syms x

int(x*sin(3*x))

ans =

1/9*sin(3*x)-1/3*x*cos(3*x)

T10.3-4 The session is:

syms x y

int(6*y^2*tan(8*x),y)

ans =

2*y^3*tan(8*x)

Given that y=x sin(3x),find

ydx

Given that z=6y2tan(8x),

find

zdy

(57)

瞭解問題測試

T10.3-5 The session is:

syms x

E = int(x*sin(3*x));

subs(E,x,5)-subs(E,x,-2)

ans =

0.6672

Solve

5

2

x sin(3 ) x dx

(58)

泰勒級數

taylor(f,n,a)這個函數可以求出定義於算式 f 中的函數的 n-1 階泰勒級數,所根據計算的點為 x = a。如果參數 a 被 省略,則此函數回傳的級數是根據 x = 0 所計算的。

>>syms x

>>f = exp(x);

>>taylor(f,4) ans =

1+x+1/2*x^2+1/6*x^3

>>taylor(f,3,2) ans =

exp(2)+exp(2)*(x-2)+1/2*exp(2)*(x-2)^2

(59)

加總

symsum(E,a,b) 可以傳回當預設符號由 a 遞增到 b,算 式 E 的符號加總。

>>syms k n

>>symsum(k,0,10) ans =

55

>>symsum(k^2, 1, 4) ans =

30

>>symsum(k,0,n-1) ans =

1/2*n^2-1/2*n

(60)

極限

函數 limit(E) 可以用來求出當 x

0的時候 E 的極限。

>>syms a x

>>limit(sin(a*x)/x) ans =

a

另外limit(E,v,a)這個形式可以用來求出當v

a 時的極限。

舉例來說,

>>syms h x

>>limit((x-3)/(x^2-9),3) ans =

1/6

>>limit((sin(x+h)-sin(x))/h,h,0) ans =

cos(x)

(61)

而limit(E,v,a,’right’)與limit(E,v,a,’left’)這個形式可以用來指 定由不同方向趨近某一個值所求出的極限。舉例來說,

>>syms x

>>limit(1/x,x,0,’left’) ans =

-inf

>>limit(1/x,x,0,’right’) ans =

inf

(62)

瞭解問題測試

T10.3-6 The session is:

syms x

taylor(cos(x),5)

ans =

1-1/2*x^2+1/24*x^4

T10.3-7 The session is:

syms m

symsum(m^3)

ans =

1/4*m^4-1/2*m^3+1/4*m^2

Find the first three nonzero terms in Taylor series for cosx.

Find a formula for the sum

1 3 0 m

m

m

(63)

瞭解問題測試

T10.3-8 The session is:

syms x

symsum(cos(pi*x),0,7)

ans =

0

T10.3-9 The session is:

syms x

limit((2*x-10)/(x^3-125),5)

ans =

2/75

Evaluate

5 3

2 10 limx 125

x

x

Evaluate

7

0

cos( )

n

n

(64)

END

HW

4, 13, 19, 29

(65)

使用dsolve函數求解微分方程式

用來求解單一方程式的dsolve函數的語法為dsolve (’eqn’) 此函數會回傳符號表式 eqn所代表的常微分方程式(ODE) 的符號解。

>>dsolve(’Dy+2*y=12’) ans =

6+C1*exp(-2*t)

(66)

在方程式中可以具有符號常數。例如,

>>dsolve(’Dy=sin(a*t)’) ans =

(-cos(a*t)+C1*a)/a

(67)

下面是一個二階的例子:

dsolve(’D2y=c^2*y’) ans =

C1*exp(-c*t) + C2*exp(c*t)

(68)

求解整組微分方程式

整組方程式也是使用dsolve函數求解。正確的語法為 dsolve(’eqn1’,’eqn2’,...)

>>[x, y] = dsolve(’Dx=3*x+4*y’,’Dy=-4*x+3*y’) x =

C1*exp(3*t)*cos(4*t)+C2*exp(3*t)*sin(4*t) y =

-C1*exp(3*t)*sin(4*t)+C2*exp(3*t)*cos(4*t)

(69)

指定起始條件以及邊界條件

使用指定的自變數值對應到的值來求解方程式,需要 使用下列的方式來處理。

函數dsolve(’eqn’, ’cond1’, ’cond2’,...) 這個形式會回傳指定於符號表示式 eqn 中的常微分 方程式的符號解,所根據的條件指定於算式cond1、

cond2之中。

如果 y是應變數,則這些條件可以以下列方式指定:

y(a) = b、 Dy(a) = c 、 D2y(a) = d,其餘依 此類推。

(70)

舉例來說,

>>dsolve(’D2y=c^2*y’,’y(0)=1’,’Dy(0)=0’) ans =

1/2*exp(c*t)+1/2*exp(-c*t)

任意的邊界條件,例如 y(0) c,都可以使用。舉例來說,

>>dsolve(’Dy+a*y=b’,’y(0)=c’) ans =

1/a*b+exp(-a*t)*(-1/a*b+c)

(71)

具有邊界條件的方程式組

我們可以藉由輸入下列的方式來求解具有邊界條件的方程 式組。

函數dsolve(’eqn1’,’eqn2’,...,’cond1’,

’cond2’,...)會傳回以符號表示式 eqn1 以及 eqn2 等所表示出來的一組方程式的符號解,所根據的起始條件 指定於cond1以及cond2等算式之中。

(72)

舉例來說,

>>dsolve(’Dx=3*x+4*y’,’Dy=

-4*x+3*y’, ’x(0)=0’,’y(0)=1’) [x,y] =

x = exp(3*t)*sin(4*t), y = exp(3*t)*cos(4*t)

不一定要指定 t = 0 的起始條件。可以指定其他時間值 t 所對 應的值當作條件。

>>dsolve(’D2y+9*y=0’,’y(0)=1’,’Dy(pi)=2’) ans =

-2/3*sin(3*t)+cos(3*t)

更多相關資料請查詢課本第10-35~10-36頁

(73)

拉氏轉換

>>syms b t

>>laplace(t^3) ans =

6/s^4

>>laplace(exp(-b*t)) ans =

1/(s+b)

>>laplace(sin(b*t)) ans =

b/(s^2+b^2)

(74)

反拉氏轉換

>>syms b s

>>ilaplace(1/s^4) ans =

1/6*t^3

>>ilaplace(1/(s+b)) ans =

exp(-b*t)

>>ilaplace(b/(s^2+b^2) ans =

sin(b*t)

更多相關資料請查詢課本第 10-38~10-47頁

(75)

特徵方程式以及特徵根

>>syms k

>>A = [0 ,1;-k, -2];

>>poly(A) ans =

x^2+2*x+k

>>solve(ans) ans =

[ -1+(1-k)^(1/2) ] [ -1-(1-k)^(1/2) ]

更多相關資料請查詢課本第 10-47~10-50頁

(76)

藉著 inv(A) 以及 det(A) 函數,你可以用符號的方式求出 矩陣的反矩陣以及行列式。

>>inv(A) ans =

[ -2/k, -1/k ] [ 1, 0 ]

>>A*ans % verify that the inverse is correct ans =

[ 1, 0 ] [ 0, 1 ]

>>det(A) ans =

k

(77)

你可以使用 MATLAB 中的矩陣方法,以符號的形式來求解線 性代數方程式。在反矩陣存在的情況下,你可以使用反矩陣 法,或使用左除法(請參考第6章中對於這些方法的討論)。

>>syms c

>>A = sym([2, -3; 5, c]);

>>b = sym([3; 19]);

>>x = inv(A)*b % the matrix inverse method x =

[3*c/(2*c+15)+57/(2*c+15)]

[23/(2*c+15)]

>>x = A\b % the left-division method x =

[3*(19+c)/(2*c+15)]

[23/(2*c+15)]

更多相關資料請查詢課本第10-49~10-50頁

(78)

下列的投影片包含課本中本章節的圖片以 及習題問題。

(79)

圖P18

(80)

圖P23

(81)

圖P24

(82)

圖P50

(83)

圖P51

參考文獻

相關文件

– Factorization is “harder than” calculating Euler’s phi function (see Lemma 51 on p. 406).. – So factorization is hardest, followed by calculating Euler’s phi function,

了⼀一個方案,用以尋找滿足 Calabi 方程的空 間,這些空間現在通稱為 Calabi-Yau 空間。.

2.1.1 The pre-primary educator must have specialised knowledge about the characteristics of child development before they can be responsive to the needs of children, set

Reading Task 6: Genre Structure and Language Features. • Now let’s look at how language features (e.g. sentence patterns) are connected to the structure

• ‘ content teachers need to support support the learning of those parts of language knowledge that students are missing and that may be preventing them mastering the

 Promote project learning, mathematical modeling, and problem-based learning to strengthen the ability to integrate and apply knowledge and skills, and make. calculated

Now, nearly all of the current flows through wire S since it has a much lower resistance than the light bulb. The light bulb does not glow because the current flowing through it

volume suppressed mass: (TeV) 2 /M P ∼ 10 −4 eV → mm range can be experimentally tested for any number of extra dimensions - Light U(1) gauge bosons: no derivative couplings. =>