Matlab learning ------ values, variables and expressions, matlab ------
(1) plural
Multiple numbers can be input directly according to the expression (do not use variables whenever possible), or between numbers and virtual parts *
Example:
>> num=3+4inum = 3.0000 + 4.0000i>> num=3+4*inum = 3.0000 + 4.0000i
Complex operation functions:
Real (z) calculates the real part of the plural;
Imag (z) is used to obtain the imaginary part of the plural number;
Abs (z) calculates the modulus of the plural;
Angle (z) calculates the phase angle of the plural.
Instance:
>> num=3+4*inum = 3.0000 + 4.0000i>> real(num)ans = 3>> imag(num)ans = 4>> abs(num)ans = 5>> angle(num)ans = 0.9273
(2) Inf and NaN
Inf is the abbreviation of Infinity, indicating positive Infinity. This constant must be introduced when 0 is used for Division;
NaN is the abbreviation of Not-a-Number, indicating a non-numeric value.
Instance:
>> 1/0ans = Inf>> 0/0ans = NaN
(3) Determine whether the input is a Matlab Keyword: iskeyword
>> iskeywordans = 'break' 'case' 'catch' 'classdef' 'continue' 'else' 'elseif' 'end' 'for' 'function' 'global' 'if' 'otherwise' 'parfor' 'persistent' 'return' 'spmd' 'switch' 'try' 'while'>> iskeyword whileans = 1>> iskeyword('while')ans = 1
How does matlab assign values to variables in a symbolic expression?
What are D, P, and Q?
How can I assign values to multiple variables in a matlab expression?
Multiple Substitutions:
Subs (cos (a) + sin (B), {a, B}, {sym ('alpha'), 2}) returns
Cos (alpha) + sin (2)
Use subs.
Then, use the double command to convert it to a value.