第五章习题"/>
MATLAB揭秘--第五章习题
- 1
octave:7> s = 7*sqrt(2)-5*sqrt(60)+5*sqrt(8)
s = -14.688
- 2
octave:9> syms x;
octave:10> q = 3*x.^2+2*x;
octave:11> s = solve(q==7)
s = (sym 2×1 matrix)⎡ 1 √22⎤⎢- ─ + ───⎥⎢ 3 3 ⎥⎢ ⎥⎢ √22 1⎥⎢- ─── - ─⎥⎣ 3 3⎦
- 3
octave:15> syms x;
octave:16> q = x.^2+sqrt(5)*x-pi;
octave:17> s = solve(q)
s = (sym 2×1 matrix)⎡ _________⎤⎢ √5 ╲╱ 5 + 4⋅π ⎥⎢- ── + ───────────⎥⎢ 2 2 ⎥⎢ ⎥⎢ _________ ⎥⎢ ╲╱ 5 + 4⋅π √5⎥⎢- ─────────── - ──⎥⎣ 2 2 ⎦
- 4
octave:19> syms x;
octave:20> q = sqrt(2*x-4);
octave:21> s = solve(q==1)
s = (sym) 5/2
- 5
octave:23> clear
octave:24> syms t;
octave:25> q = 2*t.^3-t.^2+4*t-6;
octave:26> s = solve(q)
s = (sym 3×1 matrix)⎡ _____________ ⎤⎢1 ⎛ 1 √3⋅ⅈ⎞ ╱ 289 √2658 23 ⎥⎢─ + ⎜- ─ - ────⎟⋅3 ╱ ─── + ───── - ─────────────────────────────────⎥⎢6 ⎝ 2 2 ⎠ ╲╱ 216 36 _____________⎥⎢ ⎛ 1 √3⋅ⅈ⎞ ╱ 289 √2658 ⎥⎢ 36⋅⎜- ─ - ────⎟⋅3 ╱ ─── + ───── ⎥⎢ ⎝ 2 2 ⎠ ╲╱ 216 36 ⎥⎢ ⎥⎢ _____________⎥⎢1 23 ⎛ 1 √3⋅ⅈ⎞ ╱ 289 √2658 ⎥⎢─ - ───────────────────────────────── + ⎜- ─ + ────⎟⋅3 ╱ ─── + ───── ⎥⎢6 _____________ ⎝ 2 2 ⎠ ╲╱ 216 36 ⎥⎢ ⎛ 1 √3⋅ⅈ⎞ ╱ 289 √2658 ⎥⎢ 36⋅⎜- ─ + ────⎟⋅3 ╱ ─── + ───── ⎥⎢ ⎝ 2 2 ⎠ ╲╱ 216 36 ⎥⎢ ⎥⎢ _____________ ⎥⎢ 23 1 ╱ 289 √2658 ⎥⎢ - ──────────────────── + ─ + 3 ╱ ─── + ───── ⎥⎢ _____________ 6 ╲╱ 216 36 ⎥⎢ ╱ 289 √2658 ⎥⎢ 36⋅3 ╱ ─── + ───── ⎥⎣ ╲╱ 216 36 ⎦
- 6
octave:29> clear
octave:30> syms x y z;
octave:31> a = x-3*y-2*z;
octave:32> b = 2*x-4*y-3*z;
octave:33> c = -3*x+6*y+8*z;
octave:34> s = solve(a==6,b==8,c==-5)
s =scalar structure containing the fields:x =<class sym>y =<class sym>z =<class sym>
octave:35> x = s.x,y = s.y,z = s.z
x = (sym) 1
y = (sym) -3
z = (sym) 2
- 7
>> syms x;
>> q = exp(x)-x.^2;
>> s = solve(q==0)
s = -2*lambertw(0, -1/2)-2*lambertw(0, 1/2)
>> double(s)
ans =1.5880 - 1.5402i-0.7035 + 0.0000i
- 8
>> syms x;
>> q = tan(x).^2-sec(x).^2;
>> s = simplify(q)
s =
-1
- 9
>> syms x;
>> q = taylor(tan(x),10)
q =
x + x^3/3 + (2*x^5)/15 + (17*x^7)/315 + (62*x^9)/283
- 10
刚刚电脑突然卡死,MATLAB的数据也丢失了,就用网上的在线编辑器弄出了答案:
octave:37> clear
octave:38> syms x;
octave:39> q = 4/(5-cos(x));
octave:40> s = taylor(q,'order',10,'expansionpoint',0)
s = (sym)8 6 4 2 241⋅x 113⋅x 5⋅x x ────── - ────── + ──── - ── + 1258048 23040 192 8
更多推荐
MATLAB揭秘--第五章习题
发布评论