% using figure, plot, subplot

% create figure
figure(1);

% parameters
n = 10; % number of random values

% create first subplot
subplot(2,2,1);
randomvalues = rand(n,2);
% plot values with red cross
% more details with help plot
plot(randomvalues(:,1), randomvalues(:,2),'rx');
hold on;
title('Zufallswerte');
hold off

% create second subplot
subplot(2,2,2);
x = -pi:.01:pi; % x = -pi to pi
y = sin(x);
plot(x,y);
hold on;
title('sin(x)');
hold off;

% create third subplot
subplot(2,2,3);
filename = 'logo.gif';
% show image
imshow(filename);
hold on;
title(['Bild: ' filename]);
hold off;

% create fourth subplot
subplot(2,2,4);
% read image
image = imread(filename);
% cast to double
doubleImage = double(image);
stepSize = 10; % step size for the histogram
hist(doubleImage(:),0:stepSize:max(doubleImage(:)));    % doubleImage(:) creates vector
hold on;
xlim([0 255]);
title('Histogramm');
hold off;






