Plotting file data, MATLAB in Engineering

Assignment Help:

Plotting File data:

It is frequently essential to read data from a file and plot it. Generally, this entails knowing the format of the file. For illustration, let us suppose that a company has two divisions, called A &B. The file 'ab06.dat' has 4 lines in it (we will suppose this), with the sales figures in millions for the two divisions for each quarter of the year 2006. For illustration, the file may appear like this (the format will be precisely like this):

A5.2B6.4

A3.2B5.5

A4.4B4.3

A4.5B2.2

 

The script below reads the data and plots in one Figure Window the data as the bar charts. The script prints an error message when the file open is not successful or when the file close was unsuccessful. The axis command is used to force the x-axis to range from 0 to 3 and the y-axis from 0 to 8 that will result in the axes shown here. The numbers 1 and 2 would display on the x-axis instead of the division labels A and B by default. The set function modifies the XTickLabel property to use the strings in the cell array as labels on the tick marks on the

x-axis; and gca returns the handle to the axes in the present figure (it stands for "get present axes").

609_Plotting File data.png

Running this generates the subplot as shown in figure.

1154_Plotting File data1.png


Related Discussions:- Plotting file data

Replacing, Replacing, Finding, and separating strings: There are numer...

Replacing, Finding, and separating strings: There are numerous functions which find and replace the strings, or parts of strings, within the other strings and functions which

Example of gauss-jordan, Example of Gauss-jordan: For a 2×2 system, th...

Example of Gauss-jordan: For a 2×2 system, this would results and for a 3 × 3 system, Note that the resulting diagonal form does not involve the right-most col

Technique to create nested structures, Technique to create Nested structure...

Technique to create Nested structures: This technique is the most proficient. Though, the other technique is to build the nested structure one field at a time. As this is a ne

Illustration of anonymous functions, Illustration of anonymous functions: ...

Illustration of anonymous functions: Dissimilar functions stored in the M-files, when no argument is passed to an anonymous function, the parentheses should still be in the fu

Forward elimination, Forward elimination: In forward elimination, we w...

Forward elimination: In forward elimination, we want to obtain a 0 in the a 21 position. To accomplish this, we can alter the second line in the matrix by subtracting from it

Illustration of symbolic variable, Illustration of symbolic variable: ...

Illustration of symbolic variable: When, on the other hand, z is a symbolic variable to start with, quotes are not required around the expression, and the words are automatica

Signal and system, . Generate the following signal, x(n)=1+cos((25*pi...

. Generate the following signal, x(n)=1+cos((25*pi*n)/100),0 Compute the DTFT of x[n] for w=0:0.01:2*pi Plot the Real part, imaginary part, the amplitude and phas

Simplification functions, Simplification Functions: There are numerous...

Simplification Functions: There are numerous functions which work with expressions, and simplify the terms. Not all the expressions can be simplified, but the simplify functio

Algorithm for the function e, Algorithm for the function e: The algori...

Algorithm for the function e: The algorithm for the function eoption is as shown: Use the menu function to show the 4 choices. Error-check (an error would take place

Storing strings in cell arrays, Storing Strings in Cell Arrays: The on...

Storing Strings in Cell Arrays: The one good application of a cell array is to store strings of various lengths. As cell arrays can store various types of values in the elemen

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd