MATLAB揭秘--第六章习题

octave:2> syms x;
octave:3> f = sin(4*x)./x;
octave:4> s = lim(f,0)
octave:4> limit(f,0)
ans = (sym) 4
octave:12> syms x;
octave:13> f = (x-2)/abs(x-2);
octave:14> s1 = limit(f,x,2,'left')
s1 = (sym) -1
octave:15> s2 = limit(f,x,2,'right')
s2 = (sym) 1
 syms x;
 f = x/(x.^2-3*x);
 ezplot(f)
 hold on;
 q = x.^2-3*x==0;
 s = solve(q);
plot([-8 8],[0 0],'--')
hold on;
plot([3 3],[-2 2],'k--')

1

 syms theta;
 f = cos(theta)/(1+sin(theta));
 s = limit(f,theta,pi/2)
 s =
 0 
syms x;
f = 1/(3*x^2+1);
q1 = diff(f,x,1)
q2 = diff(f,x,2)

q1 =
 
-(6*x)/(3*x^2 + 1)^2
 
 
q2 =
 
(72*x^2)/(3*x^2 + 1)^3 - 6/(3*x^2 + 1)^2

2
6.

syms y(t);
q = diff(y,t,2)-11*diff(y,t,1)==-4*cos(6*t);
s = dsolve(q)


s =
 
(2*157^(1/2)*cos(6*t - atan(11/6)))/471 + exp(11*t)*C2 + C1
 
syms x(t);
q = diff(x,t,1)==-2*x+8;
s = dsolve(q);
c = [1:5];
for i = 1:5
    f = subs(s,c(i));
    ezplot(f);
    hold on;
    
end

3
8.

syms y(t);
q1 = diff(y,t,2)-diff(y,t,1)-2*y==2*t;
cond1 = y(0)==0;
cond2 = diff(y,t,1);
s = dsolve(q1,cond1,cond2(0)==0)
s =
 
exp(2*t)/6 - (2*exp(-t))/3 - t + 1/2
syms x(t) p(t);
q1 = diff(x,t,2)+x==0;
q2 = diff(p,t,1)+p+x==0;
cond1 = x(0)==4;
cond2 = diff(x,t,1);
cond3 = p(0)==0;
s = dsolve(q1,q2,cond1,cond2(0)==0,cond3)
s.p
s.x


s = 

  包含以下字段的 struct:

    p: [1×1 sym]
    x: [1×1 sym]

 
ans =
 
2*exp(-t) - 2*2^(1/2)*cos(- pi/4 + t)
 
 
ans =
 
4*cos(t)
syms x(t) p(t);
q1 = diff(x,t,2) + 2*diff(x,t,1)+x==0;
q2 = diff(p,t,1)==x;
cond1 = x(0)==1;
cond2 = diff(x,t,1);
cond3 = p(0)==0;
s = dsolve(q1,q2,cond1,cond2(0)==0,cond3);
p1=s.p
x1 = s.x
ezplot(s.p,s.x)
p1 =
 
2 - t*exp(-t) - 2*exp(-t)
 
 
x1 =
 
exp(-t) + t*exp(-t)

4

发布了98 篇原创文章 · 获赞 18 · 访问量 6555

猜你喜欢

转载自blog.csdn.net/qq_44486550/article/details/105622442