%%
x = -3:0.1:3; %(define your x steps)
y = x.*x; %(define y)
plot(x,y)

%%
x1=linspace(-10,10,1001); %(define your x steps)
y1=linspace(-10,10,1001)'; %(define your y steps)
[X,Y]=meshgrid(x1,y1); %(combine both into a matrix)
z = X.^2+Y.^2;
imagesc(x1,y1,z) % (2D plot)

%%
surf(x1,y1,z); shading interp; colorbar % (3D plot)

%%
x1=linspace(-10,10,1001); %(define your x steps)
y1=linspace(0,20,1001)'; %(define your y steps)
[X,Y]=meshgrid(x1,y1); %(combine both into a matrix)

wave1D = cos(x1);
plot(x1,wave1D);

%%
wave2D1 = cos(X + 2*Y);
wave2D2 = cos(0.1*X.^2 + 0.1*Y.^2);
figure;
imagesc(x1,y1,wave2D1) % (2D plot)
figure;
imagesc(x1,y1,wave2D2) % (2D plot)

%%
wave1 = cos(0.1*(X-2).^2 + 0.1*Y.^2); 
wave2 = cos(0.1*(X+2).^2 + 0.1*Y.^2);
interference = wave1+wave2;
figure
imagesc(x1,y1, wave1) % (wave 1)
figure
imagesc(x1,y1, wave2) % (wave 2)
figure
imagesc(x1,y1, interference) % (sum of the two)

%%
t = 0:0.1:6; %(define your time steps)
y1 = exp(-2*t).*cos(5*t); %(?>k)
y2 = exp(-2*t).*cos(0.2*t); %(?<k)
figure; hold on; 
plot(t,y1,'r')
plot(t,y2,'k')

%%
x = -3:0.1:3; %(define your x steps)
y = x.*x; %(define y)
dy = diff(y)/0.1;
figure; hold on; 
plot(x,y,'k');
plot(x(1:end-1),dy,'r');

%%
syms x1;
y1 = x1.*x1;
dy1 = diff(y1);
ezplot (dy1, [-3 3]);

%%
syms x;
fun= exp(-x).*cos(x);
dfun = diff(fun);
Q = int(fun,x);
%Q = int(fun,x,[1 2]);
%double(Q)

%%
syms n; %(Defines x to be a symbol instead of a variable)
fun= n;
count= 1;
for i=0:0.1:3		
    integral(count) = int(fun, n,[0 i]);
    count  = count + 1;
end
x = 0:0.1:3;
y = x;
figure; hold on; 
plot(x,y,'k');
plot(x,integral,'r');

%%
Int_y = 0.5*x.*x;
plot(x,Int_y,'b');

%%
syms n; %(Defines x to be a symbol instead of a variable)
fun= cos(n);
count= 1;
for i=0:0.1:3		
    integral(count) = int(fun, n,[0 i]);
    count  = count + 1;
end
x = 0:0.1:3;
y = cos(x);
figure; hold on; 
plot(x,y,'k');
plot(x,integral,'r');

%%
Int_y = sin(x);
plot(x,Int_y,'b');
%%
syms n; %(Defines x to be a symbol instead of a variable)
fun= exp(-n).*cos(n)-n+0.5*n.*n;
count= 1;
for i=0:0.1:3		
    integral(count) = int(fun, n,[0 i]);
    count  = count + 1;
end
x = 0:0.1:3;
y = exp(-x).*cos(x)-x+0.5*x.*x ;
figure; hold on; 
plot(x,y,'k');
plot(x,integral,'r');

%%
syms x;
y= tan(x);
int(y, x, [-pi/2 pi/2])

%%
x1 = -3.1/2:0.1:3.1/2; %(define x-axis)
y1 = tan(x1); %(define your function)
plot(x1,y1)

%%
figure
hold on
ezplot(y,[-pi/2 pi/2]);
ezplot(0*x,[-pi/2 pi/2]);

%%



