You are on page 1of 1

Experiment no.

6
%obtain graphs b/w different functions n variable
%GRAPH FOR ST.LINE
x=0:0.3:2;
y=2*x+4;
plot(x,y,'+');
plot(x,y,'-');
xlabel('x');
ylabel('y=2*x+4');
title('st.line');
%GRAPH FOR SIN FUNCTION
x=0:pi/100:4*pi;
y=sin(x);
plot(x,y);
xlabel('x');
ylabel('sin x');
title('sine curve');
%GRAPH FOR COSINE FUNCTION
x=0:pi/120:pi;
y=cos(x);
plot(x,y);
xlabel('x');
ylabel('cos x');
title('cosine curve');
%GRAPH FOR CYLINDER
t=0:pi/200:4*pi;
[x,y,z]=cylinder(4*cos(t));
subplot(2,2,1);mesh(x)
subplot(2,2,2);mesh(y);
subplot(2,2,3);mesh(z);
subplot(2,2,4);mesh(x,y,z);
title('cylinder');

You might also like