搜档网
当前位置:搜档网 › matlab统计工具箱函数

matlab统计工具箱函数

matlab统计工具箱函数
matlab统计工具箱函数

% Statistics Toolbox

% betafit - Beta parameter estimation.

% binofit - Binomial parameter estimation.

% dfittool - Distribution fitting tool.

% evfit - Extreme value parameter estimation.

% expfit - Exponential parameter estimation.

% gamfit - Gamma parameter estimation.

% lognfit - Lognormal parameter estimation.

% mle - Maximum likelihood estimation (MLE).

% mlecov - Asymptotic covariance matrix of MLE.

% nbinfit - Negative binomial parameter estimation.

% normfit - Normal parameter estimation.

% poissfit - Poisson parameter estimation.

% raylfit - Rayleigh parameter estimation.

% unifit - Uniform parameter estimation.

% wblfit - Weibull parameter estimation.

%

% Probability density functions (pdf).

% betapdf - Beta density.

% binopdf - Binomial density.

% chi2pdf - Chi square density.

% evpdf - Extreme value density.

% exppdf - Exponential density.

% fpdf - F density.

% gampdf - Gamma density.

% geopdf - Geometric density.

% hygepdf - Hypergeometric density.

% lognpdf - Lognormal density.

% mvnpdf - Multivariate normal density.

% nbinpdf - Negative binomial density.

% ncfpdf - Noncentral F density.

% nctpdf - Noncentral t density.

% ncx2pdf - Noncentral Chi-square density.

% normpdf - Normal (Gaussian) density.

% pdf - Density function for a specified distribution. % poisspdf - Poisson density.

% raylpdf - Rayleigh density.

% tpdf - T density.

% unidpdf - Discrete uniform density.

% unifpdf - Uniform density.

% wblpdf - Weibull density.

%

% Cumulative Distribution functions (cdf).

% betacdf - Beta cdf.

% binocdf - Binomial cdf.

% cdf - Specified cumulative distribution function.

% chi2cdf - Chi square cdf.

% ecdf - Empirical cdf (Kaplan-Meier estimate).

% evcdf - Extreme value cumulative distribution function.

% expcdf - Exponential cdf.

% fcdf - F cdf.

% gamcdf - Gamma cdf.

% geocdf - Geometric cdf.

% hygecdf - Hypergeometric cdf.

% logncdf - Lognormal cdf.

% nbincdf - Negative binomial cdf.

% ncfcdf - Noncentral F cdf.

% nctcdf - Noncentral t cdf.

% ncx2cdf - Noncentral Chi-square cdf.

% normcdf - Normal (Gaussian) cdf.

% poisscdf - Poisson cdf.

% raylcdf - Rayleigh cdf.

% tcdf - T cdf.

% unidcdf - Discrete uniform cdf.

% unifcdf - Uniform cdf.

% wblcdf - Weibull cdf.

%

% Critical Values of Distribution functions.

% betainv - Beta inverse cumulative distribution function.

% binoinv - Binomial inverse cumulative distribution function.

% chi2inv - Chi square inverse cumulative distribution function.

% evinv - Extreme value inverse cumulative distribution function.

% expinv - Exponential inverse cumulative distribution function.

% finv - F inverse cumulative distribution function.

% gaminv - Gamma inverse cumulative distribution function.

% geoinv - Geometric inverse cumulative distribution function.

% hygeinv - Hypergeometric inverse cumulative distribution function.

% icdf - Specified inverse cdf.

% logninv - Lognormal inverse cumulative distribution function.

% nbininv - Negative binomial inverse distribution function.

% ncfinv - Noncentral F inverse cumulative distribution function.

% nctinv - Noncentral t inverse cumulative distribution function.

% ncx2inv - Noncentral Chi-square inverse distribution function.

% norminv - Normal (Gaussian) inverse cumulative distribution function. % poissinv - Poisson inverse cumulative distribution function.

% raylinv - Rayleigh inverse cumulative distribution function.

% tinv - T inverse cumulative distribution function.

% unidinv - Discrete uniform inverse cumulative distribution function.

% unifinv - Uniform inverse cumulative distribution function. % wblinv - Weibull inverse cumulative distribution function. %

% Random Number Generators.

% betarnd - Beta random numbers.

% binornd - Binomial random numbers.

% chi2rnd - Chi square random numbers.

% evrnd - Extreme value random numbers.

% exprnd - Exponential random numbers.

% frnd - F random numbers.

% gamrnd - Gamma random numbers.

% geornd - Geometric random numbers.

% hygernd - Hypergeometric random numbers.

% iwishrnd - Inverse Wishart random matrix.

% lognrnd - Lognormal random numbers.

% mvnrnd - Multivariate normal random numbers.

% mvtrnd - Multivariate t random numbers.

% nbinrnd - Negative binomial random numbers.

% ncfrnd - Noncentral F random numbers.

% nctrnd - Noncentral t random numbers.

% ncx2rnd - Noncentral Chi-square random numbers.

% normrnd - Normal (Gaussian) random numbers.

% poissrnd - Poisson random numbers.

% randg - Gamma random numbers (unit scale).

% random - Random numbers from specified distribution.

% randsample - Random sample from finite population.

% raylrnd - Rayleigh random numbers.

% trnd - T random numbers.

% unidrnd - Discrete uniform random numbers.

% unifrnd - Uniform random numbers.

% wblrnd - Weibull random numbers.

% wishrnd - Wishart random matrix.

%

% Statistics.

% betastat - Beta mean and variance.

% binostat - Binomial mean and variance.

% chi2stat - Chi square mean and variance.

% evstat - Extreme value mean and variance.

% expstat - Exponential mean and variance.

% fstat - F mean and variance.

% gamstat - Gamma mean and variance.

% geostat - Geometric mean and variance.

% hygestat - Hypergeometric mean and variance.

% lognstat - Lognormal mean and variance.

% nbinstat - Negative binomial mean and variance.

% ncfstat - Noncentral F mean and variance.

% nctstat - Noncentral t mean and variance.

% ncx2stat - Noncentral Chi-square mean and variance.

% normstat - Normal (Gaussian) mean and variance.

% poisstat - Poisson mean and variance.

% raylstat - Rayleigh mean and variance.

% tstat - T mean and variance.

% unidstat - Discrete uniform mean and variance.

% unifstat - Uniform mean and variance.

% wblstat - Weibull mean and variance.

%

% Likelihood functions.

% betalike - Negative beta log-likelihood.

% evlike - Negative extreme value log-likelihood.

% explike - Negative exponential log-likelihood.

% gamlike - Negative gamma log-likelihood.

% lognlike - Negative lognormal log-likelihood.

% nbinlike - Negative likelihood for negative binomial distribution. % normlike - Negative normal likelihood.

% wbllike - Negative Weibull log-likelihood.

%

% Descriptive Statistics.

% bootstrp - Bootstrap statistics for any function.

% corr - Linear or rank correlation coefficient.

% corrcoef - Linear correlation coefficient with confidence intervals. % cov - Covariance.

% crosstab - Cross tabulation.

% geomean - Geometric mean.

% grpstats - Summary statistics by group.

% harmmean - Harmonic mean.

% iqr - Interquartile range.

% kurtosis - Kurtosis.

% mad - Median Absolute Deviation.

% mean - Sample average (in MATLAB toolbox).

% median - 50th percentile of a sample.

% moment - Moments of a sample.

% nanmax - Maximum ignoring NaNs.

% nanmean - Mean ignoring NaNs.

% nanmedian - Median ignoring NaNs.

% nanmin - Minimum ignoring NaNs.

% nanstd - Standard deviation ignoring NaNs.

% nansum - Sum ignoring NaNs.

% nanvar - Variance ignoring NaNs.

% prctile - Percentiles.

% quantile - Quantiles.

% range - Range.

% skewness - Skewness.

% std - Standard deviation (in MATLAB toolbox).

% tabulate - Frequency table.

% trimmean - Trimmed mean.

% var - Variance (in MATLAB toolbox).

%

% Linear Models.

% addedvarplot - Created added-variable plot for stepwise regression.

% anova1 - One-way analysis of variance.

% anova2 - Two-way analysis of variance.

% anovan - n-way analysis of variance.

% aoctool - Interactive tool for analysis of covariance.

% dummyvar - Dummy-variable coding.

% friedman - Friedman's test (nonparametric two-way anova).

% glmfit - Generalized linear model fitting.

% glmval - Evaluate fitted values for generalized linear model.

% kruskalwallis - Kruskal-Wallis test (nonparametric one-way anova).

% leverage - Regression diagnostic.

% lscov - Least-squares estimates with known covariance matrix.

% lsqnonneg - Non-negative least-squares.

% manova1 - One-way multivariate analysis of variance.

% manovacluster - Draw clusters of group means for manova1.

% multcompare - Multiple comparisons of means and other estimates.

% polyconf - Polynomial evaluation and confidence interval estimation.

% polyfit - Least-squares polynomial fitting.

% polyval - Predicted values for polynomial functions.

% rcoplot - Residuals case order plot.

% regress - Multivariate linear regression.

% regstats - Regression diagnostics.

% ridge - Ridge regression.

% robustfit - Robust regression model fitting.

% rstool - Multidimensional response surface visualization (RSM).

% stepwise - Interactive tool for stepwise regression.

% stepwisefit - Non-interactive stepwise regression.

% x2fx - Factor settings matrix (x) to design matrix (fx).

%

% Nonlinear Models.

% nlinfit - Nonlinear least-squares data fitting.

% nlintool - Interactive graphical tool for prediction in nonlinear models. % nlpredci - Confidence intervals for prediction.

% nlparci - Confidence intervals for parameters.

%

% Design of Experiments (DOE).

% bbdesign - Box-Behnken design.

% candexch - D-optimal design (row exchange algorithm for candidate set). % candgen - Candidates set for D-optimal design generation.

% ccdesign - Central composite design.

% cordexch - D-optimal design (coordinate exchange algorithm).

% daugment - Augment D-optimal design.

% dcovary - D-optimal design with fixed covariates.

% ff2n - Two-level full-factorial design.

% fracfact - Two-level fractional factorial design.

% fullfact - Mixed-level full-factorial design.

% hadamard - Hadamard matrices (orthogonal arrays).

% lhsdesign - Latin hypercube sampling design.

% lhsnorm - Latin hypercube multivariate normal sample.

% rowexch - D-optimal design (row exchange algorithm).

%

% Statistical Process Control (SPC).

% capable - Capability indices.

% capaplot - Capability plot.

% ewmaplot - Exponentially weighted moving average plot.

% histfit - Histogram with superimposed normal density.

% normspec - Plot normal density between specification limits.

% schart - S chart for monitoring variability.

% xbarplot - Xbar chart for monitoring the mean.

%

% Multivariate Statistics.

% Cluster Analysis.

% cophenet - Cophenetic coefficient.

% cluster - Construct clusters from LINKAGE output.

% clusterdata - Construct clusters from data.

% dendrogram - Generate dendrogram plot.

% inconsistent - Inconsistent values of a cluster tree.

% kmeans - k-means clustering.

% linkage - Hierarchical cluster information.

% pdist - Pairwise distance between observations.

% silhouette - Silhouette plot of clustered data.

% squareform - Square matrix formatted distance.

%

% Dimension Reduction Techniques.

% factoran - Factor analysis.

% pcacov - Principal components from covariance matrix.

% pcares - Residuals from principal components.

% princomp - Principal components analysis from raw data.

matlab,isrgb函数源代码

function y = isrgb(x) %ISRGB Return true for RGB image. % FLAG = ISRGB(A) returns 1 if A is an RGB truecolor image and % 0 otherwise. % % ISRGB uses these criteria to determine if A is an RGB image: % % - If A is of class double, all values must be in the range % [0,1], and A must be M-by-N-by-3. % % - If A is of class uint8 or uint16, A must be M-by-N-by-3. % % Note that a four-dimensional array that contains multiple RGB % images returns 0, not 1. % % Class Support % ------------- % A can be of class uint8, uint16, or double. If A is of % class logical it is considered not to be RGB. % % See also ISBW, ISGRAY, ISIND. % Copyright 1993-2003 The MathWorks, Inc. % $Revision: 1.15.4.2 $ $Date: 2003/08/23 05:52:55 $ wid = sprintf('Images:%s:obsoleteFunction',mfilename); str1= sprintf('%s is obsolete and may be removed in the future.',mfilename); str2 = 'See product release notes for more information.'; warning(wid,'%s\n%s',str1,str2); y = size(x,3)==3; if y if isa(x, 'logical') y = false; elseif isa(x, 'double') % At first just test a small chunk to get a possible quick negative m = size(x,1); n = size(x,2); chunk = x(1:min(m,10),1:min(n,10),:); y = (min(chunk(:))>=0 && max(chunk(:))<=1); % If the chunk is an RGB image, test the whole image

matlab代码大全

MATLAB主要命令汇总 MATLAB函数参考 附录1.1 管理用命令 函数名功能描述函数名功能描述 addpath 增加一条搜索路径 rmpath 删除一条搜索路径 demo 运行Matlab演示程序 type 列出.M文件 doc 装入超文本文档 version 显示Matlab的版本号 help 启动联机帮助 what 列出当前目录下的有关文件 lasterr 显示最后一条信息 whatsnew 显示Matlab的新特性 lookfor 搜索关键词的帮助 which 造出函数与文件所在的目录 path 设置或查询Matlab路径 附录1.2管理变量与工作空间用命令 函数名功能描述函数名功能描述 clear 删除内存中的变量与函数 pack 整理工作空间内存 disp 显示矩阵与文本 save 将工作空间中的变量存盘 length 查询向量的维数 size 查询矩阵的维数 load 从文件中装入数据 who,whos 列出工作空间中的变量名 附录1.3文件与操作系统处理命令 函数名功能描述函数名功能描述 cd 改变当前工作目录 edit 编辑.M文件 delete 删除文件 matlabroot 获得Matlab的安装根目录 diary 将Matlab运行命令存盘 tempdir 获得系统的缓存目录 dir 列出当前目录的内容 tempname 获得一个缓存(temp)文件 ! 执行操作系统命令 附录1.4窗口控制命令 函数名功能描述函数名功能描述 echo 显示文件中的Matlab中的命令 more 控制命令窗口的输出页面format 设置输出格式 附录1.5启动与退出命令 函数名功能描述函数名功能描述 matlabrc 启动主程序 quit 退出Matlab环境 startup Matlab自启动程序 附录2 运算符号与特殊字符附录 2.1运算符号与特殊字符 函数名功能描述函数名功能描述

几种常见窗函数及其MATLAB程序实现

几种常见窗函数及其MATLAB程序实现 2013-12-16 13:58 2296人阅读评论(0) 收藏举报 分类: Matlab(15) 数字信号处理中通常是取其有限的时间片段进行分析,而不是对无限长的信号进行测量和运算。具体做法是从信号中截取一个时间片段,然后对信号进行傅里叶变换、相关分析等数学处理。信号的截断产生了能量泄漏,而用FFT算法计算频谱又产生了栅栏效应,从原理上讲这两种误差都是不能消除的。在FFT分析中为了减少或消除频谱能量泄漏及栅栏效应,可采用不同的截取函数对信号进行截短,截短函数称为窗函数,简称为窗。 泄漏与窗函数频谱的两侧旁瓣有关,对于窗函数的选用总的原则是,要从保持最大信息和消除旁瓣的综合效果出发来考虑问题,尽可能使窗函数频谱中的主瓣宽度应尽量窄,以获得较陡的过渡带;旁瓣衰减应尽量大,以提高阻带的衰减,但通常都不能同时满足这两个要求。 频谱中的如果两侧瓣的高度趋于零,而使能量相对集中在主瓣,就可以较为接近于真实的频谱。不同的窗函数对信号频谱的影响是不一样的,这主要是因为不同的窗函数,产生泄漏的大小不一样,频率分辨能力也不一样。信号的加窗处理,重要的问题是在于根据信号的性质和研究目的来选用窗函数。图1是几种常用的窗函数的时域和频域波形,其中矩形窗主瓣窄,旁瓣大,频率识别精度最高,幅值识别精度最低,如果仅要求精确读出主瓣频率,而不考虑幅值精度,则可选用矩形窗,例如测量物体的自振频率等;布莱克曼窗主瓣宽,旁瓣小,频率识别精度最低,但幅值识别精度最高;如果分析窄带信号,且有较强的干扰噪声,则应选用旁瓣幅度小的窗函数,如汉宁窗、三角窗等;对于随时间按指数衰减的函数,可采用指数窗来提高信噪比。表1 是几种常用的窗函数的比较。 如果被测信号是随机或者未知的,或者是一般使用者对窗函数不大了解,要求也不是特别高时,可以选择汉宁窗,因为它的泄漏、波动都较小,并且选择性也较高。但在用于校准时选用平顶窗较好,因为它的通带波动非常小,幅度误差也较小。

matlab统计工具箱函数

% Statistics Toolbox % betafit - Beta parameter estimation. % binofit - Binomial parameter estimation. % dfittool - Distribution fitting tool. % evfit - Extreme value parameter estimation. % expfit - Exponential parameter estimation. % gamfit - Gamma parameter estimation. % lognfit - Lognormal parameter estimation. % mle - Maximum likelihood estimation (MLE). % mlecov - Asymptotic covariance matrix of MLE. % nbinfit - Negative binomial parameter estimation. % normfit - Normal parameter estimation. % poissfit - Poisson parameter estimation. % raylfit - Rayleigh parameter estimation. % unifit - Uniform parameter estimation. % wblfit - Weibull parameter estimation. % % Probability density functions (pdf). % betapdf - Beta density. % binopdf - Binomial density. % chi2pdf - Chi square density. % evpdf - Extreme value density. % exppdf - Exponential density. % fpdf - F density. % gampdf - Gamma density. % geopdf - Geometric density. % hygepdf - Hypergeometric density. % lognpdf - Lognormal density. % mvnpdf - Multivariate normal density. % nbinpdf - Negative binomial density. % ncfpdf - Noncentral F density. % nctpdf - Noncentral t density. % ncx2pdf - Noncentral Chi-square density. % normpdf - Normal (Gaussian) density. % pdf - Density function for a specified distribution. % poisspdf - Poisson density. % raylpdf - Rayleigh density. % tpdf - T density. % unidpdf - Discrete uniform density. % unifpdf - Uniform density. % wblpdf - Weibull density. % % Cumulative Distribution functions (cdf). % betacdf - Beta cdf.

matlab潮流计算工具箱使用手册

MATPOWER A M ATLAB? Power System Simulation Package Version 3.2 September 21, 2007 User’s Manual Ray D. Zimmerman Carlos E. Murillo-Sánchez rz10@https://www.sodocs.net/doc/394939935.html, carlos_murillo@https://www.sodocs.net/doc/394939935.html, ? 1997-2007 Power Systems Engineering Research Center (PS ERC) School of Electrical Engineering, Cornell University, Ithaca, NY 14853

Table of Contents Table of Contents (2) 1Introduction (3) 2Getting Started (4) 2.1System Requirements (4) 2.2Installation (4) 2.3Running a Power Flow (4) 2.4Running an Optimal Power Flow (4) 2.5Getting Help (4) 3Technical Reference (6) 3.1Data File Format (6) 3.2Modeling (8) 3.3Power Flow (11) 3.4Optimal Power Flow (12) 3.4.1AC OPF Formulation (13) 3.4.2DC OPF Formulation (21) 3.5Unit Decommitment Algorithm (22) 3.6MATPOWER Options (22) 3.7Summary of the Files (28) 4Acknowledgments (33) 5References (33) Appendix A: Notes on LP-Solvers for M ATLAB (34) Appendix B: Additional Notes (34) Appendix C: Auction Code (35)

MATLAB有三十多个工具箱大致可分为两类:功能型工具箱和领域型工具箱 (2)

MATLAB有三十多个工具箱大致可分为两类:功能型工具箱和领域型工具箱. 功能型工具箱主要用来扩充MATLAB的符号计算功能、图形建模仿真功能、文字处理功能以及与硬件实时交互功能,能用于多种学科。而领域型工具箱是专业性很强的。如控制系统工具箱(Control System Toolbox)、信号处理工具箱(Signal Processing Toolbox)、财政金融工具箱(Financial Toolbox)等。 下面,将MATLAB工具箱内所包含的主要内容做简要介绍: 1)通讯工具箱(Communication Toolbox)。 令提供100多个函数和150多个SIMULINK模块用于通讯系统的仿真和分析 ——信号编码 ——调制解调 ——滤波器和均衡器设计 ——通道模型 ——同步 可由结构图直接生成可应用的C语言源代码。 2)控制系统工具箱(Control System Toolbox)。 鲁连续系统设计和离散系统设计 * 状态空间和传递函数 * 模型转换 * 频域响应:Bode图、Nyquist图、Nichols图 * 时域响应:冲击响应、阶跃响应、斜波响应等 * 根轨迹、极点配置、LQG 3)财政金融工具箱(FinancialTooLbox)。 * 成本、利润分析,市场灵敏度分析 * 业务量分析及优化 * 偏差分析 * 资金流量估算 * 财务报表 4)频率域系统辨识工具箱(Frequency Domain System ldentification Toolbox * 辨识具有未知延迟的连续和离散系统 * 计算幅值/相位、零点/极点的置信区间 * 设计周期激励信号、最小峰值、最优能量诺等 5)模糊逻辑工具箱(Fuzzy Logic Toolbox)。 * 友好的交互设计界面 * 自适应神经—模糊学习、聚类以及Sugeno推理 * 支持SIMULINK动态仿真 * 可生成C语言源代码用于实时应用

完整的遗传算法函数Matlab程序

完整的遗传算法函数Matlab程序 function [x,endPop,bPop,traceInfo] = ga(bounds,eevalFN,eevalOps,startPop,opts,... termFN,termOps,selectFN,selectOps,xOverFNs,xOverOps,mutFNs,mutOps) n=nargin; if n<2 | n==6 | n==10 | n==12 disp('Insufficient arguements') end if n<3 %Default eevalation opts. eevalOps=[]; end if n<5 opts = [1e-6 1 0]; end if isempty(opts) opts = [1e-6 1 0]; end if any(eevalFN<48) %Not using a .m file if opts(2)==1 %Float ga e1str=['x=c1; c1(xZomeLength)=', eevalFN ';']; e2str=['x=c2; c2(xZomeLength)=', eevalFN ';']; else %Binary ga e1str=['x=b2f(endPop(j,:),bounds,bits); endPop(j,xZomeLength)=',... eevalFN ';']; end else %Are using a .m file if opts(2)==1 %Float ga e1str=['[c1 c1(xZomeLength)]=' eevalFN '(c1,[gen eevalOps]);']; e2str=['[c2 c2(xZomeLength)]=' eevalFN '(c2,[gen eevalOps]);']; else %Binary ga e1str=['x=b2f(endPop(j,:),bounds,bits);[x v]=' eevalFN ... '(x,[gen eevalOps]); endPop(j,:)=[f2b(x,bounds,bits) v];']; end end if n<6 %Default termination information termOps=[100];

MATLAB各类工具箱

序号工具箱备注 数学、统计与优化 1Symbolic Math Toolbox符号数学工具箱 2Partial Differential Euqation Toolbox偏微分方程工具箱 3Statistics Toolbox统计学工具箱 4Curve Fitting Toolbox曲线拟合工具箱 5Optimization Toolbox优化工具箱 6Global Optimization Toolbox全局优化工具箱 7Neural Network Toolbox神经网络工具箱 8Model-Based Calibration Toolbox基于模型矫正工具箱 信号处理与通信 9Signal Processing Toolbox信号处理工具箱 10DSP System Toolbox DSP[size=+0]系统工具箱11Communications System Toolbox通信系统工具箱 12Wavelet Toolbox小波工具箱 13Fixed-Point Toolbox定点运算工具箱 14RF Toolbox射频工具箱 15Phased Array System Toolbox相控阵系统工具箱 控制系统设计与分析 16Control system Toolbox控制系统工具箱 17System Indentification Toolbox系统辨识工具箱 18Fuzzy Logic Toolbox模糊逻辑工具箱 19Robust Control Toolbox鲁棒控制工具箱 20Model Predictive Control Toolbox模型预测控制工具箱21Aerospace Toolbox航空航天工具箱 图像处理与计算机视觉 22Image Processing Toolbox图像处理工具箱 23Computer Vision System Toolbox计算机视觉工具箱 24Image Acquisition Toolbox图像采集工具箱 25Mapping Toolbox地图工具箱 测试与测量

matlab经典代码大全

哈哈哈 MATLAB 显示正炫余炫图:plot(x,y1,'* r',x,y2,'o b') 定义【0,2π】;t=0:pi/10:2*pi; 定义函数文件:function [返回变量列表]=函数名(输入变量列表) 顺序结构:选择结构 1)if-else-end语句 其格式为: if 逻辑表达式 程序模块1; else 程序模块2; End 图片读取:%选择图片路径 [filename, pathname] = ... uigetfile({'*.jpg';'*.bmp';'*.gif'},'选择图片'); %合成路径+文件名 str=[pathname,filename]; %为什么pathname和filename要前面出现的位置相反才能运行呢???%读取图片 im=imread(str); %使用图片 axes(handles.axes1); %显示图片 imshow(im); 边缘检测: global im str=get(hObject,'string'); axes (handles.axes1); switch str case ' 原图' imshow(im); case 'sobel' BW = edge(rgb2gray(im),'sobel'); imshow(BW); case 'prewitt' BW = edge(rgb2gray(im),'prewitt');

imshow(BW); case 'canny' BW = edge(rgb2gray(im),'canny'); imshow(BW);Canny算子边缘定位精确性和抗噪声能力效果较好,是一个折中方案 end; 开闭运算: se=[1,1,1;1,1,1;1,1,1;1,1,1]; %Structuring Element I=rgb2gray(im); imshow(I,[]);title('Original Image'); I=double(I); [im_height,im_width]=size(I); [se_height,se_width]=size(se); halfheight=floor(se_height/2); halfwidth=floor(se_width/2); [se_origin]=floor((size(se)+1)/2); image_dilation=padarray(I,se_origin,0,'both'); %Image to be used for dilation image_erosion=padarray(I,se_origin,256,'both'); %Image to be used for erosion %%%%%%%%%%%%%%%%%% %%% Dilation %%% %%%%%%%%%%%%%%%%%% for k=se_origin(1)+1:im_height+se_origin(1) for kk=se_origin(2)+1:im_width+se_origin(2) dilated_image(k-se_origin(1),kk-se_origin(2))=max(max(se+image_dilation(k-se_origin(1):k+halfh eight-1,kk-se_origin(2):kk+halfwidth-1))); end end figure;imshow(dilated_image,[]);title('Image after Dilation'); %%%%%%%%%%%%%%%%% %%% Erosion %%% %%%%%%%%%%%%%%%%% se=se'; for k=se_origin(2)+1:im_height+se_origin(2) for kk=se_origin(1)+1:im_width+se_origin(1) eroded_image(k-se_origin(2),kk-se_origin(1))=min(min(image_erosion(k-se_origin(2):k+halfwidth -1,kk-se_origin(1):kk+halfheight-1)-se)); end end figure;imshow(eroded_image,[]);title('Image after Erosion'); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Opening(Erosion first, then Dilation) %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Matlab各工具箱功能简介(部分)

Toolbox工具箱序号工具箱备注一、数学、统计与优化 1 Symbolic Math Toolbox 符号数学工具箱Symbolic Math Toolbox? 提供用于求解和推演符号运算表达式以及执行可变精度算术的函数。您可以通过分析执行微分、积分、化简、转换以及方程求解。另外,还可以利用符号运算表达式为 MATLAB、Simulink 和Simscape? 生成代码。?? Symbolic Math Toolbox 包含 MuPAD 语言,并已针对符号运算表达式的处理和执?行进行优化。该工具箱备有MuPAD 函数库,其中包括普通数学领域的微积分和线性代数,以及专业领域的数论和组合论。此外,还可以使用 MuPAD 语言编写自定义的符号函数和符号库。MuPAD 记事本支持使用嵌入式文本、图形和数学排版格式来记录符号运算推导。您可以采用HTML 或PDF 的格式分享带注释的推导。 2 Partial Differential Euqation Toolbox 偏微分方程工具箱偏微分方程工具箱?提供了用于在2D,3D求解偏微分方程(PDE)以及一次使用有限元分析。它可以让你指定和网格二维和三维几何形状和制定边界条件和公式。你能解决静态,时域,频域和特征值问题在几何领域。功能进行后处理和绘图效果使您能够直观地探索解决方案。你可以用偏微分方程工具箱,以解决从标准问题,如扩散,传热学,结构力学,静电,静磁学,和AC电源电磁学,以及自定义,偏微分方程的耦合系统偏微分方程。 3 Statistics Toolbox 统计学工具箱

Statistics and Machine Learning Toolbox 提供运用统计与机器学习来描述、分析数据和对数据建模的函数和应用程序。您可以使用用于探查数据分析的描述性统计和绘图,使用概率分布拟合数据,生成用于Monte Carlo 仿真的随机数,以及执行假设检验。回归和分类算法用于依据数据执行推理并构建预测模型。对于分析多维数据,Statistics and Machine Learning Toolbox 可让您通过序列特征选择、逐步回归、主成份分析、规则化和其他降维方法确定影响您的模型的主要变量或特征。该工具箱提供了受监督和不受监督机器学习算法,包括支持向量机(SVM)、促进式 (boosted) 和袋装 (bagged) 决策树、k-最近邻、k-均值、k-中心点、分层聚类、高斯混合模型和隐马尔可夫模 型。4 Curve Fitting Toolbox 曲线拟合工具箱Curve Fitting Toolbox? 提供了用于拟合曲线和曲面数据的应用程序和函数。使用该工具箱可以执行探索性数据分析,预处理和后处理数据,比较候选模型,删除偏值。您可以使用随带的线性和非线性模型库进行回归分析,也可以指定您自行定义的方程式。该库提供了优化的解算参数和起始条件,以提高拟合质量。该工具箱还提供非参数建模方法,比如样条、插值和平滑。在创建一个拟合之后,您可以运用多种后处理方法进行绘 图、插值和外推,估计置信区间,计算积分和导数。 5 Optimization Toolbox 优化工具箱 Optimization Toolbox? 提供了寻找最小化或最大化目标并同时满足限制条件

常用的MATLAB程序和函数

==等于 <小于 >大于 <=小于或等于>=大于或等于~=不等于 4 常用内部数学函数 指数函数exp(x)以e为底数 对数函数log(x)自然对数,即以e为底数的对数log10(x)常用对数,即以10为底数的对数log2(x)以2为底数的x的对数 开方函数sqrt(x)表示x的算术平方根

绝对值函数abs(x)表示实数的绝对值以及复数的模 三角函数(自变量的单位为弧度)sin(x)正弦函数cos(x)余弦函数tan(x)正切函数cot(x)余切函数sec(x)正割函数csc(x)余割函数 反三角函数asin(x)反正弦函数acos(x)反余弦函数atan(x)反正切函数acot(x)反余切函数asec(x)反正割函数acsc(x)反余割函数 双曲函数sinh(x)双曲正弦函数cosh(x)双曲余弦函数tanh(x)双曲正切函数coth(x)双曲余切函数sech(x)双曲正割函数csch(x)双曲余割函数 反双曲函数asinh(x)反双曲正弦函数acosh(x)反双曲余弦函数atanh(x)反双曲正切函数acoth(x)反双曲余切函数asech(x)反双曲正割函数acsch(x)反双曲余割函数 求角度函数atan2(y,x)以坐标原点为顶点,x轴正半轴为始边,从原点到点(x,y)的射线为终边的角,其单位为弧度,范围为( , ] 数论函数gcd(a,b)两个整数的最大公约数lcm(a,b)两个整数的最小公倍数

排列组合函数factorial(n)阶乘函数,表示n的阶乘 复数函数real(z)实部函数 imag(z)虚部函数 abs(z)求复数z的模 angle(z) 求复数z的辐角,其范围是( , ] conj(z)求复数z的共轭复数 求整函数与截尾函数ceil(x)表示大于或等于实数x的最小整数floor(x)表示小于或等于实数x的最大整数round(x)最接近x的整数 最大、最小函数max([a,b,c,...]) 求最大数min([a,b, c,..]) 求最小数 符号函数 sign(x)

matlab工具箱中文

Matlab工具箱 所谓Matlab工具箱就是一些M文件的集合, 用户可以修改工具箱中的函数,更为重要的是用户可以通过编制M文件来任意地添加工具箱中原来没有的工具函数。此功能充分体现了matlab语言的开放性。许多的专业领域在Matlab中都有自己的工具箱,假如你发现你的专业领域没有的话, 你也可以自己开发一个。 还是先来通过下面这篇Matlab的各个工具箱功能介绍的小文章,来看看有没有你所需要的吧,有感兴趣的朋友,可以到网上搜各工具箱函数的细节,相信你会好运的。 有三十多个工具箱,大致可分为两类:功能型工具箱和领域型工具箱。 功能型工具箱主要用来扩充MATLAB的符号计算功能、图形建模仿真功能、文字处理功能以及与硬件实时交互功能,能用于多种学科。而领域型工具箱是专业性很强的,如控制系统工具箱(Control System Toolbox)、信号处理工具箱(Signal Processing Toolbox)、财政金融工具箱(Financial Toolbox)等。 下面,将MATLAB工具箱内所包含的主要内容做简要介绍: 1)通讯工具箱(Communication Toolbox)。 提供100多个函数和150多个SIMULINK模块用于通讯系统的仿真和分析 ——信号编码 ——调制解调 ——滤波器和均衡器设计 ——通道模型 ——同步 可由结构图直接生成可应用的C语言源代码。 2)控制系统工具箱(Control System Toolbox)。 连续系统设计和离散系统设计 * 状态空间和传递函数 * 模型转换 * 频域响应:Bode图、Nyquist图、Nichols图 * 时域响应:冲击响应、阶跃响应、斜波响应等 * 根轨迹、极点配置、LQG 3)财政金融工具箱(FinancialTooLbox)。 * 成本、利润分析,市场灵敏度分析 * 业务量分析及优化 * 偏差分析 * 资金流量估算 * 财务报表 4)频率域系统辨识工具箱(Frequency Domain System ldentification Toolbox * 辨识具有未知延迟的连续和离散系统

Matlab程序调试相关函数.

kyboard: KEYBOARD Invoke keyboard from M-file. KEYBOARD, when placed in an M-file, stops execution of the file and gives control to the user's keyboard. The special status is indicated by a K appearing before the prompt. Variables may be examined or changed - all MATLAB commands are valid. The keyboard mode is terminated by executing the command RETURN (i.e. typing the six letters R-E-T-U-R-N and pressing the return key. Control returns to the invoking M-file. DBQUIT can also be used to get out of keyboard mode but in this case the invoking M-file is terminated. The keyboard mode is useful for debugging your M-files. See also dbquit, dbstop, return, input. Reference page in Help browser doc keyboard dbquit: Quit debug mode. The DBQUIT command immediately terminates debug mode and returns control to the base workspace prompt. The M-file being processed is NOT completed and no results are returned.

MATLAB统计工具箱中的回归分析命令

佛山科学技术学院 上机报告 课程名称数学应用软件 上机项目 MATLAB统计工具箱中的回归分析命令 专业班级 一. 上机目的 本节课我们认识了用MA TALB统计工具箱中的回归命令,主要有以下内容: regress命令即可用于多元回归分析也可用于一元线性回归,其格式如下: 1.确定回归系数的命令是regress,用命令:b=regress(Y,X). 2.求回归系数的点的估计和区间估计,并检验回归模型,用命令: [b,bint,r,rint,stats]=regress(Y,X,alpha) 3.画出残差及其置性区间,用命令: rcoplot(r,rint) 二元多项式回归:[p,S]=polyfit(x,y,2) 二. 上机内容 1.第十六章课后习题1; 2.第十六章课后习题2; 3.第十六章课后习题3。 三. 上机方法与步骤 给出相应的问题分析及求解方法,并写出Matlab程序,并有上机程序显示截图。 第1题: 要求一元线性回归方程及检验其显著性,用命令[b,bint,r,rint,stats]=regress(Y,X);求置信区间和预测值用命令rstool(x,y,'purequadratic') 回归方程及检验其显著性: x=[20 25 30 35 40 45 50 55 60 65]'; X=[ones(10,1) x]; Y=[13.2 15.1 16.4 17.1 17.9 18.7 19.6 21.2 22.5 24.3]';

[b,bint,r,rint,stats]=regress(Y,X); b,bint,stats 残差分析,作残差图: rcoplot(r,rint) 预测及作图: z=b(1)+b(2)*x plot(x,Y,'k+',x,z,'r') 预测值及置信区间: x=[20 25 30 35 40 45 50 55 60 65]'; y=[13.2 15.1 16.4 17.1 17.9 18.7 19.6 21.2 22.5 24.3]'; rstool(x,y,'purequadratic')

Matlab编写与调用函数

MATLAB 学习指南 第六章.编写与调用函数 在这一章中,我们讨论如何用多源代码文件来构造一个程序。首先,解释代码文件在MATLAB中如何工作。在编译语言中,例如FORTRAN,C ,或C++,代码被存储在一个或多个源文件中,在进行编译的时候,这些源文件组合在一起 形成了一个单独的可执行文件。作为一种解释型语言,MATLAB以一种更广泛的方式来处理多个源文件。MATLAB代码被放入带有扩展名.m的ASCII文件(或称m-文件)中。MATLAB 6 有一个集成字处理与调试应用程序,尽管会用到其它编辑程序如vi或emacs,集成字处理与调试应用程序仍是编译m-文件的首选程序。 有两种不同的m-文件。一种是脚本文件,它是一种最简单的文件,仅仅将MATLAB中的指令收集在一起。当在交互提示符处输入文件名执行脚本文件时,MATLAB在m-文件内读取并执行指令,就好像指令是我们输入的。而且,似乎我们能够削减m-文件的内容并将削减过的内容传到MATLAB指令窗口中。这种m-文件的用法将在6.1节中给予概述。 在6.2节中要讨论的第二种m-文件包含一个单一函数,此函数名与此m-文件名相同。这种m-文件包含一段独立的代码,这段代码具有一个明确规定的输入/输出界面;那就是说,传给这段代码一列空变量arg1,arg2,…,这段独立代码就能够被调用,然后返回输出值out1,out2,…。一个函数m-文件的第一个非注释行包含函数标头,其形式如下: 此m-文件以返回指令结束,将执行程序返回到函数被调用的位置。或者在交互指令提示符处或者在另一个m-文件内,无论何时用下列指令调用函数代码,函数代码都将被执行。 输入映射到空变量:arg1=var1,arg2=var2,等等。在函数主体内,输出值被分配给了变量out1,out2,等等。当遇到返回值时,当前值out1,out2,…在函数被调用处被映射到变量outvar1,outvar2,…。在用可变长度自变量和输出变量列表编写函数时,MATLAB允许更多的自由。例如,也可以使用下列指令来调用函数。 在此情况下,仅返回一个单一输出变量,这个变量在出口处包含函数变量out1的值。输入和输出自变量可能是字符串,数值,向量,矩阵,或者更高级的数据结构。 为什么使用函数呢?因为从每门计算机科学课程中可知,把一个大的程序分割 成多个可以单独执行一个被明确规定的和被注释过的任务的小程序会使大程序 易读,易于修改,不易于出错。在MATLAB中,先为程序编写一个主文件,或者是一个脚本文件或者更好的话,是一个能够返回一个单一整数的函数m-文件(返回1表示程序执行成功,0表示不完全程序执行,负值表示出现运行误差),这个主文件是程序的进入点。通过把m-文件当作函数来调用,此程序文件可以

罚函数法MATLAB程序

一、进退法、0.618法、Powell法、罚函数法的Matlab程序设计 罚函数法(通用) function y=ff(x,k) y=-17.86*0.42*x(1)/(0.8+0.42*x(1))*(1-exp(-2*(0.8+0.42*x(1))/3))*exp(-1.6)*x(2)-22. 99*x(1)/(0.8+x(1))*(1-exp(-2*(0.8+x(1))/3))*x(3)+k*(x(2)-(1.22*10^2*(9517.8*exp(-1 .6-2*0.42*x(1)/3)*x(2)+19035.6*exp(-2*x(1)/3)*x(3)))/(1.22*10^2+9517.8*exp(-1.6-2 *0.42*x(1)/3)*x(2)+19035.6*exp(-2*x(1)/3)*x(3)))^2+k*(x(3)-exp(-0.8-2*x(1)/3)*x(3) -exp(-2.4-2*0.42*x(1)/3)*x(2))^2; % 主函数,参数包括未知数的个数n,惩罚因子q,惩罚因子增长系数k,初值x0,以及允许的误差r function G=FHS(x0,q,k,n,r,h,a) l=1; while (l) x=powell(x0,n,q,r(1),h,a); %调用powell函数 g(1)=ff1(x),g(2)=ff2(x) . . . g(p)=ffp(x); %调用不等式约束函数,将其值%存入数组g h(1)=hh1(x),h(2)=hh2(x) . . . h(t)=hht(x); %调用等式约束函数,将其值 %存入数组h for i=1:p if g(i)

MATLAB常用工具箱

MATLAB常用工具箱 常用工具箱 MATLAB包括拥有数百个内部函数的主包和三十几种工具包。工具包又可以分为功能性工具包和学科工具包。功能工具包用来扩充MATLAB的符号计算,可视化建模仿真,文字处理及实时控制等功能。学科工具包是专业性比较强的工具包,控制工具包,信号处理工具包,通信工具包等都属于此类。 开放性使MATLAB广受用户欢迎。除内部函数外,所有MATLAB主包文件和各种工具包都是可读可修改的文件,用户通过对源程序的修改或加入自己编写程序构造新的专用工具包。 Matlab Main Toolbox——matlab主工具箱 Control System Toolbox——控制系统工具箱 Communication Toolbox——通讯工具箱 Financial Toolbox——财政金融工具箱 System Identification Toolbox——系统辨识工具箱 Fuzzy Logic Toolbox——模糊逻辑工具箱 Higher-Order Spectral Analysis Toolbox——高阶谱分析工具箱 Image Processing Toolbox——图象处理工具箱 LMI Control Toolbox——线性矩阵不等式工具箱 Model predictive Control Toolbox——模型预测控制工具箱 μ-Analysis and Synthesis Toolbox——μ分析工具箱 Neural Network Toolbox——神经网络工具箱 Optimization Toolbox——优化工具箱 Partial Differential Toolbox——偏微分方程工具箱 Robust Control Toolbox——鲁棒控制工具箱 Signal Processing Toolbox——信号处理工具箱

相关主题