当前位置:网站首页>Day (2) of picking up matlab
Day (2) of picking up matlab
2022-04-23 15:59:00 【Sola_ Ex】
Pick up MATLAB The second day of the
Matlab
Matlab Predefined variables in
- ans: The variable name of the preset calculation result
- eps:Matlab Defined positive minima = 2.2204e^(-16)
- pi: 3.14xxxxxxxxxxxxxx
- inf: infinity
- NaN: Cannot define
- i or j: An imaginary unit
- ....
Matlab assignment
Matlab Assignment in , You can not define variables first or use variables directly
5+6
ans = 11
a = 5;
b = 6;
a+b
ans = 11
The effect is the same , The key is the matrix ,
y = [1 2 3 4]; % Row vector
y = [6:7:8:9]; % Column vector
y' % Transposition
Matlab arithmetic
Matlab Addition, subtraction, multiplication, division and C The addition, subtraction, multiplication and division of language is no different from the use of ordinary numbers , Such as :
ans1 = a+b;
ans2 = a*b;
ans3 = a-b;
ans4 = a/b;
Max min function
- max
- min’
max(x) % Output vector X Maximum of
[Y,I] = max(X) % Output vector X The maximum value and its Y The serial number of I
min(W) % Output vector W Minimum of
[Z,J] = min(w) % Output vector W Minimum of Z And its Z The serial number of J
What is a vector (vector)
Definition : A quantity that has both direction and size is called a vector ( Contains a variety of information / The amount of multiple elements )
Build a vector
1、 Direct input method
Such as :
x=[1,2,3,4,5]
or
x=[1 2 3 4 5]
2、 Command format
x_star : x_add:x_end
- x_star Starting value
- x_add Incremental value
- x_end End value
( The default increment is 1)
Such as :
x = 1:5
The result is
x = 1 2 3 4 5
3、 Linear bisection method
linspace(int_start,int_end,n)
- int_start % The starting value of the bisection interval
- int_end % The end value of the bisection interval
- n % Divide the number equally
Vector length
In vector calculation , We must pay attention to the consistency of vector length .
command :
length(x)
Such as :
x=[1 2 3 4 4];
length(x)
Results show
ans = 8
The addition of vectors / Subtraction
Such as :
A = [1 2 3];
B = [4 5 6];
sum = A+B
diff = A-B
The result is :
sum = 5 7 9
diff = -3 -3 -3
The multiplication of vectors / division
Multiplication and division of vectors or matrices 、 power 、 Square root operation , You need to add... Before the operator “.”
Such as :
A = [1 2 3];
B = [4 5 6];
P = A.*B
Q = A./B
Power of vector (power)
"^" stay matlab Represents the caret
A = [1 2 3];
A_POWER = A.^4
The square of the vector (square root)
There is no square symbol directly on the keyboard , So change your mind , Replace the square with a power to do .
namely :
Radical sign a = a.^(1/2), And so on . Of course , Square can be used directly sqrt(x), The others can be directly made into the form of power .
版权声明
本文为[Sola_ Ex]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231554164285.html
边栏推荐
- Calculate the number of occurrences of a character
- Grbl learning (I)
- MySQL - MySQL查询语句的执行过程
- Nanny Anaconda installation tutorial
- ESP32_Arduino
- Best practices of Apache APIs IX high availability configuration center based on tidb
- Treatment of idempotency
- 建设星际计算网络的愿景
- shell_ two
- 5 minutes, turn your excel into an online database, the magic cube net table Excel database
猜你喜欢
【开源工具分享】单片机调试助手(示波/改值/日志) - LinkScope
Temporal model: long-term and short-term memory network (LSTM)
Coalesce and repartition of spark operators
Large factory technology implementation | industry solution series tutorials
Configuration of multi spanning tree MSTP
捡起MATLAB的第(4)天
Construction of esp32 compilation environment
新动态:SmartMesh和MeshBox的合作新动向
The principle and common methods of multithreading and the difference between thread and runnable
MySQL - MySQL查询语句的执行过程
随机推荐
Multi level cache usage
Pgpool II 4.3 Chinese Manual - introductory tutorial
shell_2
Date date calculation in shell script
【自娱自乐】构造笔记 week 2
Filter usage of spark operator
Go concurrency and channel
Day (7) of picking up matlab
安装Redis并部署Redis高可用集群
贫困的无网地区怎么有钱建设网络?
Grbl learning (II)
Groupby use of spark operator
C#,贝尔数(Bell Number)的计算方法与源程序
Spark 算子之coalesce与repartition
[AI weekly] NVIDIA designs chips with AI; The imperfect transformer needs to overcome the theoretical defect of self attention
TIA博图——基本操作
通过Feign在服务之间传递header请求头信息
[section 5 if and for]
MySQL - execution process of MySQL query statement
Nanny Anaconda installation tutorial