0% found this document useful (0 votes)
4 views4 pages

CAD Assignment 7

The document outlines an assignment for plotting data using MATLAB, detailing commands for graph creation, styling, labeling axes, and saving the plot. It emphasizes the importance of careful command entry due to MATLAB's case sensitivity and provides a brief overview of MATLAB's interface components. The conclusion highlights MATLAB's user-friendliness and the potential for errors if commands are not entered correctly.

Uploaded by

a4138304
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)
4 views4 pages

CAD Assignment 7

The document outlines an assignment for plotting data using MATLAB, detailing commands for graph creation, styling, labeling axes, and saving the plot. It emphasizes the importance of careful command entry due to MATLAB's case sensitivity and provides a brief overview of MATLAB's interface components. The conclusion highlights MATLAB's user-friendliness and the potential for errors if commands are not entered correctly.

Uploaded by

a4138304
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/ 4

ASSIGNMENT-7

Graph Plotting and Editing (MATLAB)


Objective
Plot the following data on MATLAB and save the plot in the filename
‘your name. fig’. Write the title of the axis, plot, and insert text. Graphs
should be drawn in different styles and colours and data points be
marked in different designs
X 0.5 1 1.5 2.0 2.5 3.01 3.6
Y 0.26 1.01 2.26 3.99 6.26 9.03 15.31
Problem Formulation
A. Basics of MATLAB
Command used
 Open MATLAB.
 Give the values of data x as {x=[0.5 1 1.5 2.0 2.5 3.01 3.6]} and press
ENTER key.
 Now give the values of data y as {y=[0.26 1.01 2.26 3.99 6.26 9.03 15.31]}
and press ENTER key.
 Now plot the graph by the command {plot(x,y)} and press ENTER key.
 Now change the colour of the graph as red by the command {plot(x,y,'r')}
and press ENTER key.
 Now give the command {hold on} to hold the graph and press ENTER key.
 Now mark the points on the graph by the command {plot(x,y,'o')} and press
ENTER key.
 Now change the line width of the graph by the command
{plot(x,y,'LineWidth',2)} and press ENTER key.
 Now change the style of line by the command {plot(x,y,'LineStyle','--')} and
press ENTER key.
 Again change the style of line by the command {plot(x,y,'LineStyle','-')} and
press ENTER key.
 Again change the colour of the graph as green by the command
{plot(x,y,'g')} and press ENTER key.
 Now label the x-axis of the graph as time by the command {xlabel('time')
and press ENTER key.
 Now label the y-axis of the graph as velocity by the command
ylabel('velocity') and press ENTER key.
 Now add the title of the graph as “velocity vs time graph” by the command
{title('velocity vs time graph') and press ENTER key.
 Add the legend of the graph as “bike1” by the command {legend('bike1')}
and press ENTER key.
 Now save the graph as “sundus.fig” by the command {savefig('sundus.fig')}
and press ENTER key.

Results:
Discussion on result
 We find a different style colour and mark on the graph
Conclusion
 MATLAB is easy to use and understand
Sources of errors
 The command may be wrong.
Suggestion
 Type the command carefully.
 MATLAB is case-sensitive always use lowercase while giving
the command.

Brief description
1. Command Window
The Command Window enables us to enter individual statements at the command
line, indicated by the prompt (>>). As you enter statements, the Command Window
displays the results. For example plot(x,y) to plot the 2D graph.
2. Command History
The Command History window displays a log of statements that you ran in the
current and previous MATLAB sessions. The Command History lists the time and
date of each session in the short date format for your operating system, followed by
the statements from that session.
3. Current Directory
The current folder is a reference location that MATLAB uses to find files. This
folder is sometimes referred to as the current directory, current working folder, or
present working directory.
4. Workspace Window
The workspace contains variables that you create or import into MATLAB from
data files or other programs. You can view and edit the contents of the workspace
in the Workspace browser or in the Command Window. For more information, see
Create and Edit Variables.
5. Figure Window
Figure objects are the individual windows on the screen in which MATLAB
displays the graphical output. figure creates a new figure object using the default
property value. Creates a new figure object using the values of the properties
specified.
6. Edit Window
The MATLAB Editor Window is a simple text editor where you can load, edit and
save complete MATLAB programs. The Editor window also has a menu command
(Debug/Run) which allows you to submit the program to the command window.

You might also like