Assignment 1
Assignment 1
syms x n s;
x = linspace(-3*pi, 3*pi);
plot(x, cos(x), '-');
hold on;
x = linspace(-2*pi, 2*pi);
s = 0;
for n = 0:3
s = s + ( (-1)^n * ( x.^(2*n) / factorial(2*n) ) );
end
plot(x, s, '--');
hold on;
s = 0;
for n = 0:5
s = s + ( (-1)^n * ( x.^(2*n) / factorial(2*n) ) );
end
plot(x, s, '--');
s = 0;
for n = 0:10
s = s + ( (-1)^n *( x.^(2*n) / factorial(2*n) ) );
end
plot(x, s, '--');
grid on;
ylim([-9 9]);
xlim([-9 9]);
Code:
syms x n
x = linspace(-15, 15);
s = 0;
for n = 0:10
s = s + ( ((-1)^n) * (x.^(2*n)) ) / ( (2^(2*n)) * factorial((n)^2) ) ;
end
plot(x, s);
hold on;
grid on;
Code:
syms x
x = -0.74:0.01:3;
fx = log(3 + 4.*x);
plot(x, fx);
hold on;
t3x = log(3) + 4.*x/ 3 - ( ( 8*(x.^2) )/ 9 ) + ( ( 64*(x.^3) )/ 81 );
plot(x, t3x, '--');
grid on;
ylim([-15 80]);
Code:
[x,y] = meshgrid(-6:0.2:6);
Z = 16-(x-3).^2-(y-2).^2;
surf(x,y,z)
Code:
(a)
[x,y,z] = meshgrid(1:0.2:15);
fx = x.*y.*log(z) + 3.*tan(z./2);
isosurface(x,y,z,fx,5)
grid on;
(b)
[x,y,z] = meshgrid(1:0.2:15);
gx = log(25-5.*x.^2-5.*y.^2-z.^2);
isosurface(x, y, z, gx, 5);
grid on;
Code:
x = 0.1:0.01:2;
y = 1280./( x.^(3/2));
plot(x,y);
grid on;
hold on;
y1 = 1100./(x.^(3/2));
plot(x,y1,'--');
y2 = 1000./(x.^(3/2));
plot(x,y2,'--');
y3 = 900./(x.^(3/2));
plot(x,y3,'--');