Page 87 - MATLAB an introduction with applications
P. 87
72 ——— MATLAB: An Introduction with Applications
S =
2.0000
2.0000
2.0000
–1.0000
% Therefore x = 2.0000, x = 2.0000, x = 2.0000, x = –1.0000.
2
4
3
1
Example E1.22: Use diff command for symbolic differentiation of the following functions:
(a) S = e x 8
1
3
(b) S = 3 x e x 5
2
3
2
(c) S = 5x – 7x + 3x + 6
3
Solution:
(a) >> syms x
>> S1= exp (x^8);
>> diff (S1)
ans =
8*x^7*exp(x^8)
(b) >> S2=3*x^3*exp(x^5);
>> diff (S2)
ans =
9*x^2*exp(x^5) +15*x^7*exp(x^5)
(c) >> S3=5*x^3–7*x^2+3*x+6;
>> diff (S3)
ans =
15*x^2–14*x + 3
Example E1.23: Use MATLAB’s symbolic commands to find the values of the following integrals:
0.7
(a) ∫ 0.2 ||xdx (b) ∫ 0 π (cos + y 2 )dy
7
y
(c) x (d) 7x 5 − 6x 4 + 11x 3 + 4x 2 + 8 + 9
x
(e) cosa
Solution:
(a) >>syms x, y, a, b
>> S1= abs(x)
>> int (S1, 0.2, 0.7)
ans =
9/40
(b) >> S2=cos (y) +7*y^2
>> int (S2, 0, pi)
ans =
7/3*pi^3
F:\Final Book\Sanjay\IIIrd Printout\Dt. 10-03-09