% Plots a 2D section

% Line plot of a chirp signal
 x=0:0.05:5;           
 y=sin(x.^1.8);          
 plot(x,y);
 grid
 
 pause
 
 % Sample semilog plot
 x=0:0.05:5;           
 y=exp(-x.^2);          
 semilogy(x,y);
 grid
 
 pause
 
  % Sample loglog plot
 t=0:0.05:5;
 x=exp(-x);
 y=exp(-x.^.2);          
 loglog(x,y);
 grid
 
 pause

 
% Bar plot of a bell shaped curve
 x = -2.9:0.2:2.9;                
 bar(x,exp(-x.*x)); 
 grid
 
 pause
 
% Stairstep plot of a sine-exp wave
 x=0:0.05:8;                   
 stairs(x,sin(x.^2).*exp(-x));
 grid
 
 pause
 
% Errorbar plot      
 x=-2:0.1:2;          
 y=erf(x);            
 e = rand(size(x))/2;
 errorbar(x,y,e);
 grid
 
 pause
 
  % Polar plot                     
 t=0:.01:2*pi;                    
 polar(t,sin(2*t).*cos(2*t));
 
 pause
 
% Stem plot            
 x = 0:0.1:4;           
 y = sin(x.^2).*exp(-x);
 stem(x,y)
 grid
 
 pause
 
% Histogram of normally distributed random numbers
% with mean of zero and unity standard deviation
x=randn(1,1000);                
hist(x); 
grid

pause

% Errorbar plot      
x=-2:0.1:2;          
y1=erf(x);            
y2=erf(1.35.*x);
plotyy(x,y,x,y2);
grid

pause

t=-3:.1:3;
[x,y]=meshgrid(t,t);
z= 3*(1-x).^2.*exp(-(x.^2) - (y+1).^2) ... 
   - 10*(x/5 - x.^3 - y.^5).*exp(-x.^2-y.^2) ... 
   - 1/3*exp(-(x+1).^2 - y.^2);
[dx,dy]=gradient(z,.2,.2);
quiver(x,y,dx,dy,3)

pause
clear

t=-3:.1:3;
[x,y]=meshgrid(t,t);
z= 3*(1-x).^2.*exp(-(x.^2) - (y+1).^2) ... 
   - 10*(x/5 - x.^3 - y.^5).*exp(-x.^2-y.^2) ... 
   - 1/3*exp(-(x+1).^2 - y.^2);
colormap(lines)
contour(x,y,z,15)
grid

 




