This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: EEE244 EE Numerical Methods and Apps. Laboratory 1 Instructor: Dr. Milica Markovi´ c Office: Riverside Hall 5026 Email: [email protected] Web:http://gaia.ecs.csus.edu/˜milica Introduction 1. Find the Matlab program by going to Start, All Programs, Matlab 2. When the Matlab window opens, you will see three window: prompt, variables and edit. Later, when we make graphs, you will also see the graphics window. Do not type the program commands directly into the prompt window. Even though this is possible you want to have the entire program in front of you, so that you can debug the program if necessary. Matlab has its own program editor. 3. To write your code, from Matlab pulldown menu select File, New. 4. Save the new file as yourname.m. Be careful when you name a matlab file: (a) Avoid all special characters. (b) Do not use space (c) Do not start the file name with a number. (d) When you start writing your code, do not name any variables the same as the name of your file. 5. Start typing your code 6. It is a good practice to write comments for each line of your code. 7. The first line of code should have the explanation of what is the purpose of the program. 8. The second line of the code should be clear all command. This command clears workspace, command screen and all variables. 9. Matlab has excellent documentation. Look for Matlab help. 10. When you are done with writing the code, run it using F5 or click on the green triangle icon on the top of the edit window. 11. If the code runs well, and you want to present the results, publish the results by clicking on File, Publish Configuration for name.m, and select edit. Output file select doc file (or html if you prefer to save your work as a html file). Then go back to File on the top menu and click publish name.m. A MS word document will open with your code, content of the command window and any figures you have generated. Introduction to Programming The two pre-requistes to writing a program are to know and understand the physical system to be modeled and a mathematical model (for example an equation) that describes this physical system. The rst step in writing a program is to develop an algorithm (or owchart) to solve a particular problem. The following list includes some frequently used algorithm steps....
View Full Document
This note was uploaded on 02/26/2010 for the course EEE EEE 244 taught by Professor Milica during the Spring '10 term at CSU Sacramento.
- Spring '10