0% found this document useful (0 votes)
23 views1 page

Adi 5

MATLAB programs readme files

Uploaded by

UIG
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views1 page

Adi 5

MATLAB programs readme files

Uploaded by

UIG
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 1

x= linspace(0,20); % generates linearly spaced vectors

y1= sin(x); % generates sine function


y2= cos(x); % generates cosine function
y3= tan(x); % generates tangent function
y4= cot(x); % generates cotangent function

figure % creates figure graphics objects


subplot(2,2,1); % divides the current figure into 2*2 grid and plot sin(x) in
grid position 1
plot(x,y1); % plots the graph of functions x and y1
grid on; % enables the grid mode
xlabel('X-axis') % labels the X-axis of the graph
ylabel('Y-axis') % labels the Y-axis of the graph
title('subplot 1= sin(x)') % establishes the title of the plot

subplot(2,2,2); % divides the current figure into 2*2 grid and plot cos(x) in
grid position 2
plot(x,y2); % plots the graph of functions x and y2
grid on; % enables the grid mode
xlabel('X-axis') % labels the X-axis of the graph
ylabel('Y-axis') % labels the Y-axis of the graph
title('subplot 2= cos(x)') % establishes the title of the plot

subplot(2,2,3); % divides the current figure into 2*2 grid and plot tan(x) in
grid position 3
plot(x,y3); % plots the graph of functions x and y3
grid on; % enables the grid mode
xlabel('X-axis') % labels the X-axis of the graph
ylabel('Y-axis') % labels the Y-axis of the graph
title('subplot 3= tan(x)') % establishes the title of the plot

subplot(2,2,4); % divides the current figure into 2*2 grid and plot cot(x) in
grid position 4
plot(x,y4); % plots the graph of functions x and y4
grid on; % enables the grid mode
xlabel('X-axis') % labels the X-axis of the graph
ylabel('Y-axis') % labels the Y-axis of the graph
title('subplot 4= cot(x)') % establishes the title of the plot

You might also like