Structure consisting of the fields, MATLAB in Mathematics

Structure Consisting of the Fields

A MATLAB can also solve the sets of equations. In this illustration, the solutions for x, y, & z are returned as a structure consisting of the fields for x, y, & z. The separate solutions are symbolic expressions stored in the fields of structure.

>> solve('4*x-2*y + z=7' , 'x+ y+ 5*z=10' , '-2*x+ 3*y-z=2')

ans =

       x: [1x1  sym]

       y: [1x1  sym]

       z: [1x1  sym]

To refer to the separate solutions, that are in the structure fields, the dot operator is used.

>> x = ans.x

x =

124/41

>> y = ans.y

y =

121/41

>> z = ans.z

z =

33/41

The double function can therefore be used to convert the symbolic expressions to numbers, and store the outcomes from the three unknowns in a vector.

>> double([x y z])

ans =

       3.0244   2.9512   0.8049

Posted Date: 10/22/2012 6:50:02 AM | Location : United States







Related Discussions:- Structure consisting of the fields, Assignment Help, Ask Question on Structure consisting of the fields, Get Answer, Expert's Help, Structure consisting of the fields Discussions

Write discussion on Structure consisting of the fields
Your posts are moderated
Related Questions
Illustration of nested function: The output arguments are distinct from variables. The scope of an output argument is merely the nested function; and it cannot be used in the

Illustration of Logical vectors: Calling the function appears to return similar vector as simply vec > 5, and summing the result still works to determine how many elements wer

Minimum and Maximum Value The MATLAB has built-in functions for numerous statistics. For illustration, min and max to find the minimum or maximum value in a data set. >> x

User-defined functions: Therefore, although many functions compute and return values, some do not. A few functions rather merely accomplish a task. Regardless of what type of

Concatenation: The String concatenation means to join the strings altogether. Of course, as strings are merely vectors of the characters, the technique of concatenating vector

Writing and Reading Spreadsheet Files: The MATLAB functions xlswrite & xlsread will write to and read from the spreadsheet files which have the extension .xls. For illustratio

Give the formula for a rational function that has a hole at x=7 & vertical asmptote at x=-3/2

Complex numbers: A complex number is commonly written in the form z = a + bi here a is known as the real part of the number z, b be the imaginary part of z, and i is √-1

Labels and Prompts: The script loads all the numbers from file into a row vector. It then splits the vector; it stores the initial element that is the experiment number in a v

Illustration of Empty vectors: The Empty vectors can also be used to delete elements from the arrays. For illustration, to remove the third element from array, an empty vector