Matlab learning notes-Basics of MATLAB

Source: Internet
Author: User

1. integer function
Round () is rounded to the nearest integer. If the decimal point is 0.5, an integer with the largest absolute value is used.
Fix () to 0 to get an integer
Floor () is not greater than the nearest integer of this number
Ceil () is not less than the nearest integer of this number
2. Common plural Functions
Complex (a, B) creates a plural number. A is the real part, and B is the virtual part.
Real (z) returns the real part of the Plural Z.
Imag (z) obtains the virtual Part Of The Plural Z.
ABS (z) gets the modulo Of The Plural Z.
Angle (z) returns the angle of the Plural Z.
Conj (z) is used to obtain the bounded plural number of Z.
3. Format () only changes the display format of the numeric value and does not change the data value. after you use format () to change the value display format, it will remain valid until you use the function Format () to modify it again.
Format () function format description
Format short or format ('short ') is displayed by default. the last four digits of the decimal point are retained.
Format long or format ('long') valid number 16 digits
Format long e valid number 16-digit plus 3-digit Index
Format short e valid number 5-digit plus 3-digit Index
Format bank or format ('bank') retain two decimal places
Format + or format ('+') Only returns Positive and Negative
Format rational or format ('rational ') is expressed as a score
Format hex or format ('hex') hexadecimal number
Format long g 15-bit valid number
Format short G 5-bit valid number
Get () gets the display format of the current value. Then, use the Set () function to modify the display format of the data, display the decimal number as a favorable score, and use the Set () function () change the data format to the original format.

4. Logic type
1 logical true ()
0 logical false ()
Both logical truth and logical false occupy one byte of storage space.
You can use help true to view the help details.
5. characters and strings
Characters and strings are not differentiated. Each character occupies 2 bytes of space.
6. function handle
Call a function using the function handle description. The data type of the function handle is function_handle. The function handle can be created using the symbol @ followed by the Function Command.
Common functions of the function handle
Function Description
Func2str (fhandle) converts a function handle to a string
Str2func (STR) converts a string to a function handle.
Functions (fhandle) returns the struct variable containing the function Information
ISA (A, 'function _ handle') determines whether it is a function handle
Isequal (fhandle1, fhandle2) checks whether two function handles correspond to the same function

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.