%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Guide for the tutorial #1 for MACN
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



m = [0 1 0 1; 1 0 0 1; 0 0 0 1; 1 1 1 0];
m


d = [25 20 11 10 10 8 7 7 7 6 6 5 4 4];

%%make a histogram
n = hist(d,10);
n
%plot a histogram
hist(d,10)

%plot
figure;
plot(d);
figure;
plot(d,'*');
x = [1 2 3 4 5 6 7 8 9 10 11 12 13 14];
figure;
plot(x,d,'*');


d = [20 11 10 10 8 7 7 7 6 6 5 4 4];
x = [1 2 3 4 5 6 7 8 9 10 11 12 13];
%plot in log scale
figure;
loglog(x,d,'k-*');

%fitting a line to the data
p = polyfit(x,d,1);
%draw the fitted line
y = p(1,1)*x+p(1,2);
%plot the data and the fitted line
figure;
plot(x,d,'k-*');
hold on;
plot(x,y);
hold off;

%load data
m = load('example_graph');
g = spconvert(m);


d1 = rand(20,1);
d2 = rand(20,1);
X = [d1 d2];
d1
d2

%compute the correlation coefficient of two vectors
C = corrcoef(d1,d2);
C

%find elements of a matrix with certain properties
I = find(m>0);
I


