Line Plots and 2 D Contour
Line Plots and 2 D Contour
Example :
Consider the coordinates x,y and z given as a function of the parameter t by
x = √t sin(2t)
y = √t cos(2t)
z = 0.5t
A plot of the points for 0 ≤ t ≤ 6π can be plotted by the following :
t=0:0.0000005:6*pi;
x=sqrt(t).*sin(2*t);
y=sqrt(t).*cos(2*t);
z=0.5*t;
plot3(x,y,z,'r','linewidth',1) %'r' for red
grid on
xlabel('x') ; ylabel('y') ; zlabel('z')
2D CONTOUR PLOT
Example :
2 + y2)
The function z = 1.8-1.5√(x sin(x)cos(0.5y) over the domain -3 ≤ x ≤ 3 and
-3 ≤ y ≤ 3
x=3:0.01:3;
y=-3:0.01:3;
[X,Y]=meshgrid(x,y);
Z=1.8.^(-1.5*sqrt(x.^2+y.^2)).*cos(0.5*Y).*sin(X);
contour(X,Y,Z,15)
xlabel('x');ylabel('y');zlabel('z')