Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

ENS101 LAB of week 10

Engineers use large amount of graphical representations, this is a deeper look in to graphics of tools.

In this Octave laboratory we will examine the graphical capabilities of the tools in hand.

Your homework is to run and analyze the following codes and report on the results. The first few examples are for you
to understand and apply the code, then you are asked to run for the remaining functions

2D plots
Name Parameter values Equations Code to generate the graph
Cycloid phi = linspace(-pi, 3*pi, 200);
ra = [0.5, 1, 1.5];
for k = 1:length(ra)
subplot(3,1,k)
plot(ra(k)*phi-sin(phi), ra(k)-cos(phi))
axis equal
title(['r_a = ' num2str(ra(k))])
axis equal off
end

Archimedean phi = linspace(0, 6*pi, 200);


spiral plot(phi.*cos(phi), phi.*sin(phi))
axis equal off

Astroid phi = linspace(0, 2*pi, 100);


plot(4*cos(phi).^3, 4*sin(phi).^3)
axis equal off

Epicycloid (2 en = [2*pi, 4*pi]; r = [3, 2.5]; a = [0.5 2];


graphs) for k = 1:2
subplot(1,2,k)
phi = linspace(0, en(k), 200);
rr = r(k); ar = a(k);
plot((rr+1)*cos(phi)-ar*cos(phi*(rr+1)),
(rr+1)*sin(phi)-ar*sin(phi*(rr+1)))
axis equal off
end

Eight curve Write the code

Butterfly Write the code

Gear Write the code


3D Plots
Name Parameter values Equations Code to generate the graph
Spherical helix t = linspace(0, 10*pi, 300);
x = t/(2*5);
plot3(sin(x).*cos(t),
sin(x).*sin(t), cos(x), 'k-')
axis equal

Concho-spiral a = 1; b = 1.05; c = 3;
u = linspace(0, 12*pi, 200);
bu = b.^u;
plot3(a*bu.*cos(u),
a*bu.*sin(u), c*bu, 'k-')
axis equal

Helical spring r1 = 0.25; r2 = 0.25; T =


2.0; n = 6;
[u, v] = meshgrid(linspace(0,
2*n*pi, 140), linspace(0, 2*pi,
25));
x = [1-r1.*cos(v)].*cos(u);
y = [1-r1*cos(v)].*sin(u);
z = r2*[sin(v)+T*u/pi];
surf(x, y, z)
view([-64 0])
surf(x, y, z)
axis vis3d equal off

Toroidal spiral Write your own code

You might also like