You are on page 1of 2

5/2/16 7:03 PM

function [

C:\Users\GilmoreJ1178\Downloads\Exam3_1.m

] = Exam3_1(

% 3D Plot Example
t = 0:0.1:10*pi;
x = t.* sin(2.*t);
y = t.*(cos(t) + sin(t));
z = (cos(t) .* sin(t));
z1 = t * .1;

%
%
%
%
%

Set the time array


Calcualte x
Calcualte y
Calcualte z
Calcualte z1

% Subplot 1 - Plot x, y, z
subplot(2, 2, 1);
plot3(x,y, z);
hold on;
plot3(x, y, z1, 'g');
grid on;
title ('3D plot');
xlabel ('t.* sin(2.*t)');
ylabel ('t.*(cos(t) + sin(t))');
zlabel ('(cos(t) .* sin(t))');
% Subplot 2 - Plot x, y
subplot(2, 2, 2)
plot(x, y, 'b');
hold on;
plot(x, y, 'g');
grid on;
title ('x - y plane');
xlabel ('t.* sin(2.*t)');
ylabel ('t.*(cos(t) + sin(t))');
% Subplot 3 - Plot x, z
subplot(2, 2, 3);
plot(x, z);
hold on;
plot(x, z1, 'g');
grid on;
title ('x - z');
xlabel ('t.* sin(2.*t)');
ylabel ('(cos(t) .* sin(t))');
% Subplot 4 - Plot y, z
subplot(2, 2, 4);
plot(y, z);
hold on;
plot (y, z1, 'g');
grid on;
title ('y - z');
xlabel ('t.*(cos(t) + sin(t))');
ylabel ('(cos(t) .* sin(t))');

1 of 2

5/2/16 7:03 PM
end

C:\Users\GilmoreJ1178\Downloads\Exam3_1.m

2 of 2

You might also like