In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the basic knowledge of matlab, which is very detailed and has a certain reference value. Friends who are interested must finish it!
1. Line continuation and ans
Add three decimal points at the end of a line of code, and you can continue typing on the next line.
Ans is the abbreviation of answer.
2. Set the current folder
Method 1. The folder path to be set by cd
Method 2. Select a file as the current folder in the current folder toolbar or in the current folder window.
3. Variable clearing
(1) clear all variables clear
(2) clear the name of some variables to be cleared by clear+
(3) keep part of the variable clearvars-except + the name of the variable to be retained
4. Clear the screen instruction
(1) clear the current window: clc
(2) clear variable: clear
(3) clear the currently active figure command: clf
5. Matlab search path
Variables-internal functions-program files (subdivided into program files under the current folder and program files in the file search path folder)
Analyzing the above code, you can see that when you run the x=sin (1) instruction for the third time, the sin variable is searched first.
6. Floating point data
Floating-point data can be divided into two types: single-precision and and double-precision, single-precision real numbers occupy 4 bytes in memory, and double-precision real numbers occupy 8 bytes in memory, so the data accuracy of double-precision real numbers is higher. (numeric data is double by default)
You can use the single function to convert other types of data to a single precision type.
Use the double function to convert other types of data to double.
7. Set the output format of the command
Format format characters, such as
Note: format only affects the format of data output, not the calculation and storage of data.
8. Common scientific functions (1) and the calling format of functions
Function name (value of function argument)
The independent variable of a function is defined as a matrix variable or a scalar. Scalar itself is a special case of a matrix. In the operation, the function acts on each element of the matrix item by item, so the final result of the operation is a matrix of the same type as the independent variable.
The sqrt () function is the root sign.
Taking the exp () function as an example, calculate the natural index value for each element of the matrix:
(2) the use of common functions I, trigonometric functions
Trigonometric functions are used in radians and angles. If it is an angle function, add "d" after the function name to show the difference.
II, absolute value function
The abs function can find the absolute value of a real number, the module of a complex number, and the ASCII code value of a string (including single quotation marks):
III, rounding function
The functions commonly used for rounding are fix, floor, ceil, round and so on.
The round function is rounded according to the rule of rounding.
The Ceil function is rounded up to the first integer greater than or equal to this number.
The Floor function rounds down to the first integer that is less than or equal to this number.
The Fix function always takes an integer close to 0, that is, rounding off decimals.
IV, take one hundred thousand bits
Find one hundred bits of a three-digit positive integer respectively, using the rem () function.
9. Assignment and management of variables
In Matlab, variable names begin with a letter, followed by letters, numbers, and underscores, with a maximum of 63 characters.
You can use who and whos to display variables that reside in the workspace:
10. Memory variable file
The file used to hold matlab workspace variables is called an in-memory variable file with a .mat extension, also known as a MAT file.
(1), save command: create a memory variable file.
(2) load command: load the memory variable file.
The command parses save mydata ABCDm, which means to store ABCDm variables in the mydata.mat file, load ('mydata.mat'), to load variables from mydata.mat into the current workspace, or double-click the .mat file to load variables.
These are all the contents of the article "what are the basics of matlab". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.