当前位置:网站首页>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
边栏推荐
- leetcode-374 猜数字大小
- R语言中实现作图对象排列的函数总结
- matplotlib教程05---操作图像
- Pgpool II 4.3 Chinese Manual - introductory tutorial
- 捡起MATLAB的第(4)天
- Neodynamic Barcode Professional for WPF V11.0
- Import address table analysis (calculated according to the library file name: number of imported functions, function serial number and function name)
- WPS brand was upgraded to focus on China. The other two domestic software were banned from going abroad with a low profile
- Multi level cache usage
- String sorting
猜你喜欢
随机推荐
Nanny Anaconda installation tutorial
gps北斗高精度卫星时间同步系统应用案例
多线程原理和常用方法以及Thread和Runnable的区别
王启亨谈Web3.0与价值互联网“通证交换”
实现缺省页面
Application case of GPS Beidou high precision satellite time synchronization system
【自娱自乐】构造笔记 week 2
Algorithem_ ReverseLinkedList
Deletes the least frequently occurring character in the string
leetcode-374 猜数字大小
捡起MATLAB的第(9)天
Day (9) of picking up matlab
Construction of esp32 compilation environment
5 minutes, turn your excel into an online database, the magic cube net table Excel database
GRBL学习(二)
s16. One click installation of containerd script based on image warehouse
The biggest winner is China Telecom. Why do people dislike China Mobile and China Unicom?
Day (10) of picking up matlab
保姆级Anaconda安装教程
下载并安装MongoDB








