%declare variables

f=5;
z=0.2;


%we can geneate vectors (or matrices) of zeros or ones (or any other constant) with only one command.

p1=zeros(1,f);
p2=zeros(f,1);
p3=ones(f,f);

%This generates a matrix with all 4's in it
p4=p3.*4;

%Cannot do the following because the dimensions are wrong
%p4=p1+p2;

p2=p2';

p4=p1+p2;

%if you want to display something to the screen, use disp
disp('Hello');


%concatenate command

x=[2 3 4 5 6];
y=[7 8 9 10 11];

cat(1,x,y);
cat(1,y,x);
cat(2,x,y);


%matrix operations as opposed to loops

N=5;

k=1:N;
res=[];
for(i=1:N)
res=cat(2,res,k(i)*k');
end;

res2=kron(k,k');


% You can generate random numbers (in this case uniform) without loops


for (i=1:N)
    nums(i)=rand;
end;

nums2=rand(N,1);

%now let us sort these numbers

nums2sorted=sort(nums2);








