| Think++ Help File | |||||||||||||||||
|
Think++ Special Characters | ||||||||||||||||
Think++ Special Characters Think++ has many inbuilt special characters that can be used. These characters allow functions to be read by the program parser. These special characters need to be used when defining functions such as matrices and plotting graphs. Click here to view list of special characters.
[
] Square
brackets. Used in the definition of matrices. ( ) Parentheses. Parentheses are used to indicate precedence in arithmetic expressions in the usual way, as well as enclose arguments of functions and subscripts of matrices.Note* Arith() needs to be placed before the parentheses for arithmetic functions. Examples: ‘x(2, 1)’ – extracts the element in row 2, column 1, which is 21 in the above matrix. ‘x(3)’ – extracts the 3rd element of the column matrix, formed by taking the columns in order from left to right of ‘x’, and placing them one beneath the other. The extracted element in this case would be 12. ‘ ’ Quotes. Used to enclose a single letter indicating the mode in which a function is to be executed, or generally to add custom text within functions which take text as an argument. Example: legend(‘Transfer characteristic of resistor R1’) = Equals. Used to assign a variable to one of the following: another variable, a number, a mathematical function, or an expression containing a combination of these. ‘==’ is the relational equals operator. ’ Single Quote. Used to find the transpose of a matrix. Example:
‘Matrix1’’ . Period. Used as a decimal point in a number as standard, or to allow element-by-element arithmetic operations of matrices. Example: ‘Matrix2 = Matrix1 .* 2’ multiplies each element in ‘Matrix1’ by 2 and stores the resulting matrix in the variable ‘Matrix2’. ... Continuation. Indicates the continuation of a statement contained in a function to the following line. , Comma. A comma is used as a separator in matrix subscripts and function arguments. It is also used to separate statements in a multi-statement line. For multi-statement lines, the comma can be replaced by a semicolon to suppress printing. Example: ‘subplot(2, 3, 1), plot(x, y)’ ; Semicolon. A semicolon is used inside brackets to end rows. Used after an expression or statement to suppress printing or to separate statements. Example: ‘a = 1 + 2;’ – assigns ‘2’ to the variable ‘a’, but will not output this as confirmation of the assignment % Percent. The percent symbol denotes a comment; it indicates a logical end of line. Any following text placed after the % symbol on the same line is ignored by the program. : Colon. A colon enables iterations to be performed. Example:
d = 1:0.5:4 % 1 is the lower limit; 4 is the upper limit, with |
|||||||||||||||||
| Copyrighted 2003 | All Rights Reserved | ||||||||||||||||