You are on page 1of 5

IT131-8L Machine Problem Answer Sheet

Machine
9 (Matlab Plots) Score
Problem #
Name Alonzo, Isaiah Benjamin B. Section A11

1. Figure Window Results:

mpplot1.m
x = randi(100,1);
y = randi(100,1);
plot(x,y,'g+');

2. Figure Window Results:

Prepared by: Geldof Resuello


Prepared date: March 2020
mpplot2.m
x = 1:5:100;
y = sqrt(x);
bar(x,y);

3. Figure Window Results:

Prepared by: Geldof Resuello


Prepared date: March 2020
mpplot3.m
for i = 1:2
x = linspace(-2*pi,2*pi,100);
y = sin(x);
y2 = cos(x);
if i == 1
subplot(2,1,i)
plot(x,y,'r.');
ylabel('sin(x)');
title('Sin(x) Plot');
else
subplot(2,1,i)
plot(x,y2,'r.');
ylabel('cos(x)');
title('Cos(x) Plot');
end
end

Prepared by: Geldof Resuello


Prepared date: March 2020
4. Figure Window Results:

subfnfn.m
function subfnfn(funA,funB)
n = randi([5,10],1);
x = 1:n;
y = funA(x);
y2 = funB(x);
for i = 1:2
if i == 1
subplot(1,2,i);
plot(x,y,'ko');
title(sprintf('%s',func2str(funA)));
else
subplot(1,2,i)
plot(x,y2,'ko');
title(sprintf('%s',func2str(funB)));
end
end

Prepared by: Geldof Resuello


Prepared date: March 2020
Prepared by: Geldof Resuello
Prepared date: March 2020

You might also like