In: Computer Science
Plot all four curves over 0 < t < 4 together using MATLAB. Post code in the response.
C1 : x=−5+2e−tcos20t y=−5+2e−tsin20t z=4t
C2 : x=−5+2e−tcos20t y=5+2e−tsin20t z=4t
C3 : x=5+2e−tcos20t y=−5+2e−tsin20t z=4t
C4 : x=5+2e−tcos20t y=5+2e−tsin20t z=4t
clc;clear all
t=0:0.001:4; %%Creating t vector from 0 to 4 with 0.001
spacing
x1=-5+2.*exp(-t).*cos(20.*t);y1=-5+2.*exp(-t).*sin(20.*t);z1=4.*t;
%%Curve 1
x2=-5+2.*exp(-t).*cos(20.*t);y2=5+2.*exp(-t).*sin(20.*t);z2=4.*t;
%%Curve 2
x3=5+2.*exp(-t).*cos(20.*t);y3=-5+2.*exp(-t).*sin(20.*t);z3=4.*t;
%%Curve 3
x4=5+2.*exp(-t).*cos(20.*t);y4=5+2.*exp(-t).*sin(20.*t);z4=4.*t;
%%Curve 4
plot3(x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4); %%Plots all curve in
one graph
xlabel('x');ylabel('y');zlabel('z') %%Adds label
legend('Plot 1','Plot 2','Plot 3','Plot 4'); %%Adds legend