TRINITY CSCI 2323 - Solving Systems of Equations

Unformatted text preview:

1Solving Systems of Equations9-14-20052Opening Discussion■What did we talk about last class?■Do you have any questions about the reading?3Structures■You can use the dot notation to put fields into a variable to make a structure. Unlike normal imperative languages, the format of the structure isn't predefined.■Matlab deals with arrays of structures just like numeric arrays.■The struct function can build arrays of structures from existing cell arrays.■You can pull out all the values of certain field with 'dynamic addressing'.4Strings■Like most other languages, Matlab does give you the ability to use strings, though that isn't a real strength.■A Matlab string is simply a row array of characters.■A downside of this is that an array with multiple strings must have all the strings be the same length. The char function can help with that.■You can also convert from numbers to strings and back with str2num and num2str.■Matlab also has fprintf and sprintf functions that work much like the C functions.■Similarly, sscanf will pull numbers out of strings.■eval and evalc let you process a string like it were a Matlab function.5Files■Save and load commands let you access native files that store Matlab variables.■Doing help fileformats will also show you all the other formats the Matlab supports normally.■You can do low level I/O with C-like functions. fopen, fclose, fread, fwrite, fscanf, fprintf, etc.■In addition, Matlab will also let you play with directories and even has built in support for ftp if you want to pull things across a network in Matlab.■Let's populate an array with a bunch of values, write it out in a text file, then read it back in.6Matrix Algebra■Now we get into the things that Matlab was really developed for and where it really stands out.■2-D arrays are basically matrices and can be used for doing all types of math.■Before we get into this we should talk about systems of linear equations and how they can be solved.■Matlab actually has routines that will try to solve systems of equations that aren't “well behaved”. That is, it will approximate both over-determined and under-determined systems.7Sparse Matrices■Matlab also has hat ability to store sparse matrices.■We aren't really going to take advantage of this in this class, but if you have a large matrix has has mostly zeros in it, this can be significant.8Reminders■Assignment #3 is due on


View Full Document

TRINITY CSCI 2323 - Solving Systems of Equations

Documents in this Course
Load more
Download Solving Systems of Equations
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Solving Systems of Equations and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Solving Systems of Equations 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?