当前位置:网站首页>Matlab learning 2022.7.4
Matlab learning 2022.7.4
2022-07-05 13:49:00 【megaData】
I used my vacation time to pass 《MATLAB Application encyclopedia 》 And Related videos to learn matlab
Common commands :
clc Used to clear the contents of the command line window
clear Used to clear variables in the workspace
whos Used to display the details of variables
who Used to list the names of variables in the workspace
Use percent sign % Annotate the program
data type :
a1 = int8(6)
a2 = int16(-20)
%int32 int64 Is a signed integer
a3 = uint32(100)
a4 = uint64(200)
%uint8 uint16 Is an unsigned integer
b1 = single(3.5)
% Single precision floating point
b2 = 12
% The default is double precision floating point double
c1 = true
%logical Logical type
c2{1,1}=100
% Is the cell array type cell
c3='hello'
%char Is string type
c4.name='robin'
% Is the structure type
[email protected]
%function_handle Is the function handle type
value type :
stay matlab among , The default value type is double precision floating point
a = 24
% The default variable is double precision floating point
b1 = int8(a)
b2 = int16(a)
b3 = int32(a)
b4 = int64(a)
c = 'hello'
int8(c)
% Convert string to 8 An integer
By function intmin() and intmax() To get the value range of integers
Rounding function of floating point numbers :
round()、fix( towards 0 integer )、floor( Not greater than this number )、ceil( Not less than this number )
a1 = round(2.5)
a2 = round(-2.4)
a3 = round(-2.5)
b1 = fix(-3.6)
b2 = fix(-3.5)
c1 = floor(-4.2)
c2 = floor(4.9)
d1 = ceil(4.2)
d2 = ceil(-4.4)
a = 123.34
b = single(a)
c1 = double(a)
c2 = int16(a)
c3 = int32(a)
d1 = [realmin('single') realmax('single')]
d2 = [realmin('double') realmax('double')]
% By function realmin() and realmax() You can get the value range of single precision and double precision floating-point numbers
Use complex(a,b) To create a complex number (a It is the real part ,b It is the imaginary part )
z1 = 3+4i
a1 = real(z1)
% Get the real part
a2 = imag(z1)
% Get the imaginary part
b1 = abs(z1)
% Get the module of the complex number
b2 = angle(z1)
c1 = conj(z1)
% Get conjugate complex
z2 = complex(1:3,2:4)
real(z2)
imag(z2)
Using functions format() To determine the display format of numeric type
The default display is :format short After decimal point 4 position
format short
a = 12.3456789
format short
a
format long
a
format long e
a
format short e
a
format bank
a
format +
a
format rational
a
format short
% Restore to the system default display format
Logical type :
a1 = true
a2 = false
a3 = true(3,4)
a4 = false(3)
clear all
a = 3
logical(a)
b=0
logical(b)
c = [1.3 -3 0;2 0 4;0.01 9 1]
logical(c)
% Convert numeric type to logical type
character :
a = 'My name is zhangsan'
b = char([65 66 67 68])
c = int8('hello')
d =' Zhang '
clear all
Use function handles to call functions indirectly
% Function handle
f1 = @cos
t = 0:pi/5:pi
f1(t)
f2 = @complex
f2(3,4)
clear all
f1 = @char
s1 = func2str(f1)
f2 = str2func(s1)
functions(f1)
isa(f1,'function_handle')
isequal(f1,f2)
clear all
边栏推荐
- Basic characteristics and isolation level of transactions
- 【 script secret pour l'utilisation de MySQL 】 un jeu en ligne sur l'heure et le type de date de MySQL et les fonctions d'exploitation connexes (3)
- MySQL get time
- Liar report query collection network PHP source code
- Win10 - lightweight gadget
- 通讯录(链表实现)
- ETCD数据库源码分析——集群间网络层客户端peerRt
- Operational research 68 | the latest impact factors in 2022 were officially released. Changes in journals in the field of rapid care
- Intranet penetration tool NetApp
- Apicloud studio3 WiFi real machine synchronization and WiFi real machine preview instructions
猜你喜欢
How to deal with the Yellow Icon during the installation of wampserver
Can graduate students not learn English? As long as the score of postgraduate entrance examination English or CET-6 is high!
Datapipeline was selected into the 2022 digital intelligence atlas and database development report of China Academy of communications and communications
Summit review | baowanda - an integrated data security protection system driven by compliance and security
"Baidu Cup" CTF competition in September, web:upload
Convolutional Neural Networks简述
这18个网站能让你的页面背景炫酷起来
Mmseg - Mutli view time series data inspection and visualization
[public class preview]: basis and practice of video quality evaluation
Laravel框架运行报错:No application encryption key has been specified
随机推荐
"Baidu Cup" CTF competition in September, web:upload
Internal JSON-RPC error. {"code":-32000, "message": "execution reverted"} solve the error
RK3566添加LED
Requests + BS4 crawl Douban top250 movie information
Usage, installation and use of TortoiseSVN
Jetpack Compose入门到精通
uplad_ Labs first three levels
Godson 2nd generation burn PMON and reload system
Assembly language - Beginner's introduction
leetcode 10. Regular Expression Matching 正则表达式匹配 (困难)
【MySQL 使用秘籍】一網打盡 MySQL 時間和日期類型與相關操作函數(三)
Idea设置方法注释和类注释
记录一下在深度学习-一些bug处理
jasypt配置文件加密|快速入门|实战
Can graduate students not learn English? As long as the score of postgraduate entrance examination English or CET-6 is high!
华为推送服务内容,阅读笔记
redis6事务和锁机制
锚点导航小demo
Redis6 master-slave replication and clustering
asp.net 读取txt文件