做网站一般字号要做多少,个人域名备案麻烦吗,wordpress网站编辑,南京做企业网站公司哪家好系列文章目录 文章目录系列文章目录前言1 基本用法总结基础语法桌面管理矩阵均匀间隔矢量矩阵创建矩阵索引前言
介绍了matlab的基本用法 1 基本用法 save filename.mat % 将当前工作区的所有变量保存为mat文件load filename.mat % 加载文件 loa…系列文章目录 文章目录系列文章目录前言1 基本用法总结基础语法桌面管理矩阵均匀间隔矢量矩阵创建矩阵索引前言
介绍了matlab的基本用法 1 基本用法 save filename.mat % 将当前工作区的所有变量保存为mat文件load filename.mat % 加载文件 load filename variable % 只加载filename.mat中的某一variablesave filename variable % 只把某个variable变量保存在filename.mat中 format long format short % 切换在command中的显示精度矩阵操作
h [1 2 3]
v [1;3;5]
c [1 3 4; 1 3 5]
y [1:10] % 1 2 3 ... 10
z 1:0.5:5 % 1 1.5 2 2.5 ... 5
b 1:5:10 % 1 6
b linspace(0,1,5) % 从 [0,1]共5个数
b b % 转置
rand(x) % x * x 随即矩阵
rand(x, y) % x row y col
ones(x, y)
zeros(x, y)
size(var) % row, col矩阵取值
matrix(row, col) % 矩阵第row行,col列
density data(:,2); % 所有第二列
volumes data(:, 3:4) % 所有第3 ~ 4列
volumes data(:, 2:end)
density([1 3 4]) % 取第1 3 6个元素矩阵运算
.* % 点乘,对应元素相乘[dr dc] size(data)
[vMax, idx] max(v2)帮助文档
doc randiplot
plot(sample, mass1)
hold on
plot(smaple, mass2, r--*)
hold offplot(sample,mass1,ks)
hold on
plot(sample,mass2,r*)
hold off
title(Sample Mass)
ylabel(Mass (g))
legend(Exp A, Exp B)文件操作 蓝色代表要导入的数据, 黄色代表缺失(NaN Not a Number) excel
excel.tableheadlogic
z v1(v14)
v1(v14) 0and
| or控制语句
if doPlot 1plot(density)title(Sample Densities)xticklabels(element)ylabel(Density (g/cm^3))
elsedisp(The density of element ... is density)
endfor idx 1:length(density)hold onplot(idx,density(idx),*)hold offpause(0.2)
end总结
基础语法
x pi创建变量并赋值π\piπy sin(-5)函数调用
桌面管理
功能egdescriptionsavesave data.mat将当前工作区的内容保存为MAT文件loadload data.mat从MAT文件中加载变量到工作区clearclcformatformat longformat short更改显示模式
矩阵
3标量[3 5]行向量[3; 5]列向量[1 2 3; 1 2 3]矩阵
均匀间隔矢量
1:4[1 2 3 4]1:0.5:2[1 1.5 2]linspace(1,10, 5)5个元素,均匀的从[1,10]
矩阵创建
rand(2)2*2方阵zeros(2,3)2row 3col 0矩阵ones(2,3)2row 3col 1矩阵
矩阵索引
将其想象成函数调用