Matlab learning ------ values, variables and expressions, matlab ------

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.