You are on page 1of 1

1 % Iterative Calculations

2 x(1) = 1; % Define the first element


3 for n = 2:20; % Maximum No of Iterations
4 x(n) = 1/n; % Calculation
5 if abs(x(n) - x(n-1)) < 0.1
6 break
7 end
8 converge = n;
9 end
10 x
11 converge
12
13 % Differentiation & Integration
14 % -----------------------------
15 x1 = sym('t^2-sin(t)');
16 dx1dt = diff(x1)
17 dx12dt2 = diff(x1,2)
18 % Partial Derivatives
19 syms a
20 g = 't^2+a*sin(s^2)';
21 diff(g,'t')
22 diff(g,'s')
23
24 % Integrals
25 syms a t
26 int(a+2*t,t,0,1)
27

You might also like