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
Customizing Plots : There are numerous ways to customize figures in the Figure Window. On clicking the Plot Tools icon will bring up the Property Editor & Plot Browser, with ma

Illustration of Writing to files: Here is the other illustration in which a matrix is written to a file. At First, an arbitrary 2 × 4 matrix is generated, and then it is writt

Three-Dimensional Plots: The MATLAB has many functions which will display three-dimensional plots. Most of these functions have similar name as corresponding two-dimensional p

bar and barh functions: For a matrix, the bar and barh functions will group altogether the values in each and every row. The illustration is as shown: rm = randint(2,4,[1

Use of string variables: The Characters involve letters of the alphabet, punctuation marks, digits, white space, and control characters. The Control characters are characters

Differentiation: The derivative of a function y = f(x) can be written as follows or f  '(x) and is defined as the rate of change of the dependent variable y with respe

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


Illustration of a recursive function: illustration is of a recursive function which does not return anything, but simply prints. The below function prtwords receives a sentenc

Function fopen - file function: The permission string in the call to the fopen function identifies that the file is opened for writing to it. Just as when reading from a file,