欢迎来到三一办公! | 帮助中心 三一办公31ppt.com(应用文档模板下载平台)
三一办公
全部分类
  • 办公文档>
  • PPT模板>
  • 建筑/施工/环境>
  • 毕业设计>
  • 工程图纸>
  • 教育教学>
  • 素材源码>
  • 生活休闲>
  • 临时分类>
  • ImageVerifierCode 换一换
    首页 三一办公 > 资源分类 > DOCX文档下载  

    matlab中二元正态分布函数.docx

    • 资源ID:3161193       资源大小:37.14KB        全文页数:4页
    • 资源格式: DOCX        下载积分:6.99金币
    快捷下载 游客一键下载
    会员登录下载
    三方登录下载: 微信开放平台登录 QQ登录  
    下载资源需要6.99金币
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    matlab中二元正态分布函数.docx

    matlab中二元正态分布函数matlab中二元正态分布函数 function data1, data2 = twogaussian(n1,mu1,cov1,n2,mu2,cov2); % % data1, data2 = twogaussian(n1,mu1,sigma1,n2,mu2,sigma2); % % Function to simulate data from 2 Gaussian densities in d dimensions % and to plot the data in the first 2 dimensions % % INPUTS: % n1, n2: two integers, size of data set 1 and 2 respectively % mu1, mu2: two vectors of dimension 1 x d, means % for data set 1 and 2 % cov1, cov2: two matrices of dimension d x d, covariance % matrices for data set 1 and 2 respectively % % OUTPUTS: % data1: n1 x d matrix of data for data set 1 % data2: n2 x d matrix of data for data set 2 % check that the dimensionality of the mu's and sigma's are consistent d1 = length(mu1); d2 = length(mu2); if (d1=d2) error('means are of different lengths'); end; d = length(mu1); % d is the dimensionality of the data d1 d2 = size(cov1); if (d1=d2) error('cov1 is a non-square covariance matrix'); end; if (d1=d) error('cov1 is of different dimensionality to mu1'); end; d1 d2 = size(cov2); if (d1=d2) error('cov2 is a non-square covariance matrix'); end; if (d1=d) error('cov2 is of different dimensionality to mu2'); end; % Call the function mvnrnd.m to generate the two data sets data1 = mvnrnd(mu1,cov1,n1); data2 = mvnrnd(mu2,cov2,n2); % Now plot the two data sets as a two-dimensional scatter plot % if d = 2: plot dimension1 on the xaxis and dimension 2 on the % yaxis. Plot the points from data1 as green circles 'o', and the % points from data2 as red crosses 'x'. if . figure % open a figure window plot(data1(:,1),data1(:,2),'b.');. % now plot data1 axis(-6 6 -6 6); % fix the lengths of the axes hold % hold the figure to overlay a 2nd plot plot(data2(:,1),data2(:,2),'rx');% now plot data 2 xlabel('Dimension 1'); ylabel('Dimension 2'); title('Simulation of two-class Gaussian data in two dimensions'); end function r = mvnrnd(mu,sigma,cases); %MVNRND Random matrices from the multivariate normal distribution. % R = MVNRND(MU,SIGMA,CASES) returns a matrix of random numbers % chosen from the multivariate normal distribution with mean vector, % MU, and covariance matrix, SIGMA. CASES is the number of rows in R. % % SIGMA is a square positive definite matrix with size equal to % the length of MU % Adapted from Mathworks function m1 n1 = size(mu); c = max(m1 n1); if m1 .* n1 = c error('Mu must be a vector.'); end m n = size(sigma); if m = n error('Sigma must be square'); end if m = c error('The length of mu must equal the number of rows in sigma.'); end T p = chol(sigma); if p = 0 error('Sigma must be a positive definite matrix.'); end if m1 = c mu = mu' end mu = mu(ones(cases,1),:); r = randn(cases,c) * T + mu;

    注意事项

    本文(matlab中二元正态分布函数.docx)为本站会员(小飞机)主动上传,三一办公仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一办公(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    备案号:宁ICP备20000045号-2

    经营许可证:宁B2-20210002

    宁公网安备 64010402000987号

    三一办公
    收起
    展开