文章目录
MATLAB学习笔记(一)基本指令
1. 建立数据
x=5; % 用分号不会在回车之后显示
x=[1 2 3]; % 创建矩阵
y=[1 2 3
4 5 6]; % 第二行可以直接空格,这个对齐我也不知道怎么办
y=[1,2,3;4,5,6]; % 数字之间可以用空格或逗号;第二行也可以用' ; '表示
2. 查看变量名
键入 who
或者 whos 查看具体细节
>> who
您的变量为:
x y
>> whos
Name Size Bytes Class Attributes
x 1x1 8 double
y 2x3 48 double
3. exist 指令
查看变量是否存在
>> exist x % 存在则结果为1
ans =
1
>> exist z % 不存在则结果为0
ans =
0
4. clear 和 clc 指令
clear: 删除变量
clc: 清除工作空间中所有的指令和结果
5. format 指令
改变数据输出格式
>> format long
>> pi
ans =
3.141592653589793
>> format short
>> pi
ans =
3.1416
6. help 指令
得到标题的相关信息
>> help a
未找到 a。
请使用帮助浏览器的搜索字段搜索文档,或者
键入 "help help" 获取有关帮助命令选项的信息,例如方法的帮助。
>> help sqrt
sqrt - 平方根
此 MATLAB 函数 返回数组 X 的每个元素的平方根。对于 X 的负元素或复数元素,sqrt(X) 生成复数结果。
B = sqrt(X)
另请参阅 nthroot, realsqrt, sqrtm
sqrt 的参考页
名为 sqrt 的其他函数
7. lookfor 指令
根据关键词提供帮助
>> lookfor sqrt
realsqrt - Real square root.
sqrt - Square root.
sqrtm - Matrix square root.
sqrtm_tbt - Square root of 2x2 matrix from block diagonal of Schur form.
sqrtm_tri - Square root of quasi-upper triangular matrix.
sqrt - Overload element-wise square root for DataMatrix object.
realsqrt - Real square root of codistributed array
sqrt - Square root of codistributed array
realsqrt - Real square root of gpuArray
sqrt - Square root of gpuArray
fi_sqrtlookup_8_bit_byte - Square root
cordicsqrt - CORDIC-based square root.
eml_fisqrt_helper - Helper function for fixed-point square root
sqrt - Square root of fi object, computed using a bisection algorithm
gsqrt - Generalized square root.
sqrtm - Matrix square root.
sqrtm - Matrix square root.
vsqrtm - function out = vsqrtm(mat)
% 这里只截取部分
感想
就我这秉性,也不知道能坚持多久。颓废.jpg
学了一会会的MATLAB,感觉和python还是有些不同的。等我学得差不多了再说这个,如果我能继续学的话。