clear;
subplot(2,2,1)
clear
[x,y] = meshgrid([-2:.1:2]);
z = x.^2+y.^2;
mesh(x,y,z)
surf(x,y,z)
set(gca,'XTick',[-2 0 2])
set(gca,'YTick',[-2 0 2])
set(gca,'ZTick',[0 5 10])
axis([-2 2 -2 2 0 10])
subplot(2,2,2)
clear;
syms x
f = sin(x);
axis([-5 5 -4 4]); hold on;
set(gca,'XTick',[-5,0,5],'YTick',[-4,-2,0,2,4]);grid on;
xd = -3:.05:3; yd = subs(f,x,xd,'r');
plot(xd, yd, 'r');hold on;
x=-3:.05:3;
T1 = x;
plot(x,T1,'r');hold on;
T2 = x-(x.^3/factorial(3));
plot(x,T2,'r');hold on;
T3 = x-((x.^3)/factorial(3))+((x.^5)/factorial(5));
plot(x,T3,'r');hold on;
T4 = x-((x.^3)/factorial(3))+((x.^5)/factorial(5))-((x.^7)/factorial(7));
plot(x,T4,'r');hold on;
T5 = x-((x.^3)/factorial(3))+((x.^5)/factorial(5))-((x.^7)/factorial(7))+((x.^9)/factorial(9));
plot(x,T5,'r');hold on;
subplot(2,2,3)
clear;
syms x
x=-3.15:.05:3.15;
f = sin(x);
plot(x,f);
axis([-5 5 -1 1]); hold on;
set(gca,'XTick',[-5,0,5],'YTick',[-1,-0.5,0,0.5,1]);grid on;
xd = -3.15:.05:3.15; yd = subs(f,x,xd,'b');
plot(xd, yd, 'b');hold on;
f2= sin(2*x);
plot(x,f2,'b');hold on;
f3= sin(3*x);
plot(x,f3,'b');hold on;
f4= sin(4*x);
plot(x,f4,'b');hold on;
f5= sin(5*x);
plot(x,f5,'b');hold on;
subplot(2,2,4)
clear
[x,y] = meshgrid([-4.9:.1:5]);
z = -(x.^2+y.^2-1);
mesh(x,y,z)
surf(x,y,z)
set(gca,'XTick',[-5 0 5])
set(gca,'YTick',[-5 0 5])
set(gca,'ZTick',[-40 -20 0])
axis([-5 5 -5 5 -50 0])