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
Give the formula for a rational function that has a hole at x=7 & vertical asmptote at x=-3/2

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

Illustration of Standard Deviation The less spread out the numbers are, therefore smaller the standard deviation will be, as it is a way of determining the spread of the data.

Writing variables to a File: The save command is used to write variables to a file, or to append the variables to a MAT-file. By the default, save function writes to a MAT-fil

Changing Dimensions: In addition to transpose operator, the MATLAB has some built-in functions which change the dimensions or configuration of matrices, involving fliplr, resh

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

Script a MATLAB program which meets the following speci cations: The program expects an input of a two-variable real-valued continuous function f : R^2--> R The program is to cal

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

Strings as matrix: The matrix can be generated, that consists of strings in each row. Therefore, essentially it is created as a column vector of strings, but the final result

Three-dimensional pie and bar: For the bar3 function, x & y vectors are passed and the function displays three-dimensional bars as shown in figure: Figure: Three-dimen