当前位置:
文档之家› matlab课后习题解答第二章doc
matlab课后习题解答第二章doc
tao=sym('tao','positive');
f=A*((1+t/tao)*(heaviside(t+tao)-heaviside(t))+(1-t/tao)*(heaviside(t)-heaviside(t-tao)));
(2)数值计算复验
xx=-10*pi:pi/100:1.7*pi;
sn=trapz(exp(-abs(xx)).*abs(sin(xx)))*pi/100
sn =
1.0877
110
〖目的〗
变上限二重积分的符号计算法。
〖解答〗
syms x y
f=x^2+y^2;
r=int(int(f,y,1,x^2),x,1,2)
d =
1/(a11*a22*a33 - a11*a23*a32 - a12*a21*a33 + a12*a23*a31 + a13*a21*a32 - a13*a22*a31)
16
〖目的〗
symsum, subs的应用。
从实例中,感受指令所给出的关于 符号解的含义。
〖解答〗
symsx k
f=x^(k);
y3d =
1.2935547796148951782413405453553
113
〖目的〗
符号离散卷积直接法和变换法。
〖解答〗
(1)直接法
syms a b kn
x=a^k;
h=b^k;
w=symsum(subs(h,k,n)*subs(x,k,k-n),n,0,k)%据定义
y1=simple(w)
w =
〖解答〗
syms x
syms n positive
f=sin(x)^n;
yn=int(f,x,0,pi/2)
y3s=vpa(subs(yn,n,sym('1/3')))
y3d=vpa(subs(yn,n,1/3))
yn =
beta(1/2, n/2 + 1/2)/2
y3s =
1.2935547796148952674767575125656
〖解答〗
(1)符号积分
syms x clear
syms x
y=exp(-abs(x))*abs(sin(x))
si=vpa(int(y,-10*pi,1.7*pi),64)
y =
abs(sin(x))/exp(abs(x))
si =
1.087849499412904913166671875948174520895458535212845987519414166
(2)求五阶方程 的实根
syms a positive%注意:关于x的假设没有去除
solve(x^2-a*x+a^2)
Warning: Explicit solution could not be found.
> In solve at 83
ans =
[ empty sym ]
syms x clear
syms a positive
solve(x^2-a*x+a^2)
ans =
a/2 + (3^(1/2)*a*i)/2
a/2 - (3^(1/2)*a*i)/2
14
a =
在此,
〖目的〗
理解准确符号数值的创建法。
高精度误差的观察。
〖解答〗
(1)x=7/3
x=7/3;a=x,b=sym(x),c=sym(x,'d'),d=sym('7/3'),
a =
2.3333
b =
7/3
c =
2.3333333333333334813630699500209
d =
7/3
v1=vpa(abs(a-d)),v2=vpa(abs(b-d)),v3=vpa(abs(c-d))
v1 =
0.0
v2 =
0.0
v3 =
0.00000000000000014802973661668756666666667788716
DA=det(A)
IA=inv(A);
[IAs,d]=subexpr(IA,d)
A =
[ a11, a12, a13]
[ a21, a22, a23]
[ a31, a32, a33]
DA =
a11*a22*a33 - a11*a23*a32 - a12*a21*a33 + a12*a23*a31 + a13*a21*a32 - a13*a22*a31
(2)x=pi/3
x=pi/3;a=x,b=sym(x),c=sym(x,'d'),d=sym('pi/3'),
a =
1.0472
b =
pi/3
c =
1.047197551196597631317786181171
d =
pi/3
v1=vpa(abs(a-d)),v2=vpa(abs(b-d)),v3=vpa(abs(c-d))
Z1=symsum(f,k,0,inf)
Z1 =
piecewise([1 <= x, Inf], [abs(x) < 1, -1/(x - 1)])
subs(Z1,x,{sym('-1/3'),sym('1/pi'),sym('3')})
ans =
[ 3/4, -1/(1/pi - 1), Inf]
hu_tao=h_tao*u_t_tao;
hut=simple(int(hu_tao,tao,0,t))%直接卷积
hut =
(3*cos(t))/10 - 3/(10*exp(3*t)) + sin(t)/10
(2)变换法(复验)
syms s;
HU=laplace(h,t,s)*laplace(u,t,s);
f=A*exp(-a*abs(t));
y=fourier(f,t,w)
F=simple(y)
y =
(2*A*a)/(a^2 + w^2)
F =
(2*A*a)/(a^2 + w^2)
116
〖目的〗
单位阶跃符号函数heaviside的应用。
subs实现多变量置换。
ezplot的使用。
〖解答〗
syms t A w;
piecewise([a = b, b^k + b^k*k], [a <> b, (a*a^k - b*b^k)/(a - b)])
y1 =
piecewise([a = b, b^k + b^k*k], [a <> b, (a*a^k - b*b^k)/(a - b)])
(2)变换法(复验)
syms z
ezplot(y,[0,2*pi])
y =
sinint(x)
y5 =
1.6541404143792439835039224868515
(2)数值计算复验
tt=0:0.001:4.5;
tt(1)=eps;
yn=trapz(sin(tt)./tt)*0.001
yn =
1.6541
112
〖目的〗
一般符号解与高精度符号数值解。
double
Cs2 =
sym
Cs3 =
sym
Cs4 =
sym
12
sym('sin(w*t)'),sym('a*exp(-X)'),sym('z*exp(j*th)')
〖目的〗
理解自由符号变量的确认规则。
〖解答〗
symvar(sym('sin(w*t)'),1)
ans =
w
symvar(sym('a*exp(-X)'),1)
v1 =
0.0
v2 =
0.0
v3 =
0.00000000000000011483642827992216762806615818554
(3)x=pi*3^(1/3)
x=pi*3^(1/3);a=x,b=sym(x),c=sym(x,'d'),d=sym('pi*3^(1/3)')
a =
4.5310
b =
1275352044764433/281474976710656
c =
4.5309606547207899041040946030989
d =
pi*3^(1/3)
v1=vpa(abs(a-d)),v2=vpa(abs(b-d)),v3=vpa(abs(c-d))
v1 =
0.00000000000000026601114166290944374842393221638
〖注意〗
解答中,条件abs(x - 1) < x + 1意味着:
约束一:x-1<x+1 2>0 此式总成立,说明“无约束”。
情况二:-(x-1)<x+1 x>0 此为“约束”,满足题意。
18
〖目的〗
diff, limit指令的应用。
如何理解运行结果。
〖解答〗
syms t
y=abs(sin(t))
d=diff(y) %求dy/dt
X=ztrans(a^k,k,z);
H=ztrans(b^k,k,z);
y2=iztrans(H*X,z,k)%通过Z变换及反变换
y2 =
piecewise([b <> 0, (a*a^k)/(a - b) - (b*b^k)/(a - b)])