%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Very basic matlab operations
%
% Defining a function f(x)
%
f=@(x) sin(x).^2;
%
% and then making a plot of f(x) versus x
%
a=0;
b=10*pi;
dx=(b-a)/200;
x=a:dx:b;
%
figure(1)
plot(x,f(x),'b-')
%
figure(2)
x=linspace(a,b);
plot(x,f(x),'b-',x,x,'r--','LineWidth',3)
title('2D-plotting in Matlab')
xlabel('x')
ylabel('y')
%
%
figure(3)
p1=subplot(2,1,1);
p2=subplot(2,1,2);
x1=-1:0.05:1;
x2=-1:0.05:1;
y1=x1.^2;
y2=sin(x1).^2;
plot(p1,x1,y1)
title(p1,'Top plot')
ylabel(p1,'x^2')
plot(p2,x2,y2)
title(p2,'Bottom plot')
ylabel(p2,'sin(x)^2')
%
%
%
%
