![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Matlab
文章平均质量分 70
空字符(公众号:月来客栈)
Talk is cheap, show me your code.
展开
-
MATLAB 基本命令
disp(var) // display variable disp(sprintf(‘2 decimals: %0.2f’,a)) //format with two decimals format long // format short // hist(w) //画出w值的直方分布图 pwd //reture the current path ls //display load原创 2017-06-17 13:16:38 · 1604 阅读 · 0 评论 -
randperm(产生随机数)、reshape(重塑矩阵)
一、randperm命令1.随机产生N个1到N的整数 P = randperm(N) returns a vector containing a random permutation of the integers 1:N. For example, randperm(6) might be [2 4 5 6 1 3].返回一个N维向量P,包含N个1到N的随机值,且不重复!>> P=rand原创 2017-07-03 21:35:17 · 2584 阅读 · 0 评论 -
mean(求均值),max/min(求最值)
一、mean命令1. mean(X) S = mean(X) is the mean value of the elements in X if X is a vector. For matrices, S is a row vector containing the mean value of each column. 若X是行向量或列向量,则返回所有元素的平均值; 若X为矩阵,则返回每一原创 2017-07-09 12:37:12 · 4497 阅读 · 0 评论 -
Matlab中如何使函数作为参数传递
在此之前,先看看如何调用函数:1.函数的调用下面的例子将在call.m脚本中,调用写在fun.m中的函数fun(a,b,c);实现a,b,c三个数相加,然后返回;%%fun.mfunction [ output ] = fun(a,b,c )output = a + b + c;end下面进行调用 % call.ms = 0;a = 1;b = 2;c = 3;s = fun(a,原创 2017-09-23 18:54:33 · 36467 阅读 · 3 评论 -
norm(范数)、bsxfun()用法
1.norm(X)如果x是一个向量,那么norm(x)就等于x的模长。||X||=x21+x22+⋯+x2n−−−−−−−−−−−−−−√;X={x1,x2⋯xn}||X||=\sqrt{x_1^2+x^2_2+\cdots+x^2_n};X=\{x_1,x_2\cdots x_n\}>> x = [3,4]>> norm(x)>> ans = 52.bsxfunC = bsx原创 2017-09-24 08:20:38 · 1873 阅读 · 0 评论