1. The command diary file_name command saves all subsequent output to
file file_name 2. Creating and using variables o Type in P=1<ENTER> n=1<ENTER> R=0.0821<ENTER> T=273<ENTER> o Variable names are case sensitive (so T is not the same is t). Variable names can include letters or numbers o Other legal variable names would be Pressure, Vol, nMoles, Rvalue, T1, ... 3. You can recall previous lines by using up-arrow key 4. Arithmetic Operations & Simple Calculations (+, -, *, /, ^) o The volume can be determined by typing V= n*R*T/P 5. The role of the Semi-colon in Matlab o Matlab will print out the answer for any command not terminated by a semi-colon. o Matlab will not print out the result if the line ends in a semi-colon 6. To find out help on a command (such as plot), type help plot (or use the pulldown help menu) 7. To list all commands which have a keyword in their description (such as sin), type lookfor sin Lists & List Arithmetic In addition to doing operations on single numbers, Matlab allows us to perform operations on a list of numbers. These lists are also called Vectors, Arrays or Matrices in the Matlab manuals. 1. There are several ways to create a list o Using the Colon notation, e.g. T= 300:10:400; o Using the zeros and ones commands, e.g. y=zeros(1,3); z = ones(1,5); o Explicitly listing terms, e.g. x = [1 4 9 16] o Reminder: If you do not include a semi-colon, the entire list will be printed 2. We can do addition, subtraction, multiplication and division of a list and a value using the (+, -, *, /) operators. Try, for example, T*2 , T/5, T+20, T/10+5 3. Array operations on a list (.* ./ and .^ operators) operate on each element of the list individually 4. Try x=1:3 y=2:4 then type operations like x.*y, x./y, x.^y 5. Type in T=300; V = 10:20; P=n*R*T./V to get the pressure at several different volumes 6. There are many intrinsic Functions (sin, cos, exp, ...) which can operate on list elements. angle=0:pi/4:pi, sin(angle) Creating Plots 1. To plot two lists, enter a command such as plot(V,P) 2. To select axis range use the axis command with a 4 element list containing [xmin, xmax, ymin, ymax], e.g. axis([5 8 1 2]) 3. To set colors and line types use optional plot arguments o plot(V,P,'ro') or plot(V,P,'b--') 4. To overlay graphs, type hold on and subsequent graphs will be on the same axes. To start a new graph, type hold off 5. Labels and titles can be added by using commands such as o xlabel('Volume (in Liters)') o ylabel('Pressure (in Atm)') o title('Ideal Gas Plot') 6. To zoom in on a graph, type zoom on and highlight a region with a mouse
Microsoft Word - Transistor Models and The Feedback Amp - Docmicrosoft Word - Transistor Models and The Feedback Amp - Doctransistor - Models - and - The - Fba