Thursday, May 16, 2024

IMPORT, EXPORT DATA IN MATLAB AND PLOTTING

Must read

IMPORTING DATA:

Where in Matlab importing data is defined as obtaining data from an external file. By using the importing data function we obtain data of different formats with various functions. There are four import functions in Matlab that are described as follows.

C= importdata (format): data from the file named as format is loaded in to the array C.

C=importdata (‘-pastespecial’): loading of records from the system clipboard in place of the document.

C= importdata (___, delimiterIn, headerlinesIn): In this function data is loaded from ASCll file, or clipboard, while the numerical reading starts from line headerlinesIn+1.

C= importdata (___, delimiterIn): In order to separate the column ASCII file or clipboard data we can use delimiterIn.

EXPORT DATA:

In matlab export data means write data in to the file. In matlab there various export data functions, Rectangular, delimited ASCII data file from an array. Diary (or log) document of keystrokes and the ensuing textual content output. Besides from the above there are another way to export a numeric array as a delimited ASCll data file:

With the help of save function we can specify the -ASCII qualifier using the dlmwrite function.

PLOTTING:

In order to plot a graph we use a graph function, to take the following steps:

To draw a graph we should outline the X values from the desired variety for which the graph is plotted.

Let us define the function by considering z=f(x)

Now let’s call plot command, as plot(x,y)

Let us plot simple function y=x for the value in the range of 0 to 200 with an increment in the value of 10.

X= [0:10:200];

z=x;

Plot(x, y)

ADDING TITLE, LABELS AND GRID LINES ON THE GRAPH:

In order to adjust the value in the graph we consider title labels and grid lines. The x label and y label instructions generate labels alongside x-axis and y-axis. The name command permits you to position a name at the graph. The grid on command permits you to position the grid traces at the graph.

- Advertisement -

More articles

- Advertisement -

Latest article