- 1
- 0
- 约1.9千字
- 约 24页
- 2017-01-10 发布于江苏
- 举报
Xidian University 数值运算 hjTang@xidian.edu.cn 数组创建 逐个构造 等差数列型 :, linspace 等比数列型 logspace, semilogx/y 工作空间浏览器 load/save命令 全1矩阵、全0矩阵、空矩阵、随机矩阵(均匀分布、正态分布) 对角阵、单位阵、魔方数组 数组的访问 A, A(:), A(:, :) A(r, c), A(r, :), A(:, c) A(I) A(L) %sizeof(A) == sizeof(L) A(2:end, 3:end) reshape, repmat flipud, fliplr, rot90 数组运算 A’, A.’, A+B, A-B A*B, A.*B, A/B, A./B, A\B, A.\B A.^a, a.^A 非数 NaN, inf, isnan, isinf 特殊操作 find ind2sub %单下标换全下标 空数组 a=[] b=rand(0) c=rand(1, 0) size(a) size(b) size(c) length(a) length(b) length(c) isempty(a) isempty(c) 关系操作 , =, , =, ==, ~= 逻辑操作 , |, ~, xor , || all, any false, true, logical isempty, isfinite, isprime, isreal, isletter, isspace, isinf, isnan isa, ishandle, ischar, islogical, isglobal, isnumeric 数值计算 差分 diff 梯度 gradient 求和 sum: sum(A, 1), sum(A, 2) 累计求和 cumsum 近似数值积分 trapz 累计近似数值积分 cumtrapz 数值积分 trapz(x, y, tol) quad(fun, a, b, tol) dblquad(fun, xmin, ymin, xmax, ymax, tol) 求极值 一元函数极值 fminbnd(fun, x1, x2, options)fminbnd(@(x)x^2+2*x-3, -1, 1) 单纯形法求多元函数的极值fminsearch(fun, x0, options) 常微分方程 数值略 矩阵和代数方程 高斯列主元消去法 [R, ci] = rref(A) 特征值、特征向量、行列式 X=null(A); A矩阵零空间的全部正交基 AX=0 Z=orth(A); A矩阵值空间的全部正交基 span(A) = span(Z) 代数方程的求解 fsolve(fun, x0) fzero(fun, x0) 对分法 概率分布图 norm, chi2, bino, f, geo, exp, poiss, t, unif, unid normpdf(x, mu, sigma)normcdf(x, nu, sigma)normrnd(nu, sigma, m, n) rand(m, n) randn(m, n) 统计指令 min(X)/max(X) mean(X) std(X) var(X) cov(X) corrcoef(X) hist/histfit P159 例4.3-5 mu=2; sigma=0.5; x=randn(1000, 1); y1=sigma*x + mu; y2=sigma*(x+mu); subplot(2, 1, 1); histfit(y1),; axis([-5 5 0 100]); subplot(2, 1, 2); histfit(y2); axis([-5 5 0 100]); 多项式运算 c = conv(p1, p2) [q, r] = deconv(p1, p2) poly2str(q, ‘x’) y = polyval(p, x) 多项式拟合 p = polyfit(x, y, n) 最小二乘法 * * unid Discrete Uniform 离散均匀分布 unif Uniform 均匀分布 t T T分布 poiss Poisson 泊松分布 norm Normal 正态分布 geo Geometric 几何分布 f F F分布 exp Exponential 指数分布 chi2 Chisquare 卡方分布 bino Binomial 二项式分布
原创力文档

文档评论(0)