matlab2c使用c++实现matlab函数系列教程-normpdf函数
2017-09-10 16:21
417 查看
全栈工程师开发手册 (作者:栾鹏)
matlab2c动态链接库下载
matlab库函数大全
matlab2c基础教程
matlab2c开发全解教程
2、将Matlab2c.dll拷贝到exe同目录下
3、将Matlab2c.h、Matlab2c.lib放到项目头文件目录下
4、在cpp文件中引入下面的代码
正态分布概率密度函数
2、用法说明
Y = normpdf(X,mu,sigma)
Y = normpdf(X) % (mu = 0, sigma = 1)
Y = normpdf(X,mu) % (sigma = 1)
输入:要求概率密度的点矩阵;aver—均值;sigma—标准差
输出矩阵点上的概率密度值
matlab2c动态链接库下载
matlab库函数大全
matlab2c基础教程
matlab2c开发全解教程
matlab2c调用方法:
1、下载动态链接库2、将Matlab2c.dll拷贝到exe同目录下
3、将Matlab2c.h、Matlab2c.lib放到项目头文件目录下
4、在cpp文件中引入下面的代码
#include "Matlab2c.h" #pragma comment(lib,"Matlab2c.lib") using namespace Matlab2c;
matlab中normpdf函数简介
1、normpdf函数:正态分布概率密度函数
2、用法说明
Y = normpdf(X,mu,sigma)
Y = normpdf(X) % (mu = 0, sigma = 1)
Y = normpdf(X,mu) % (sigma = 1)
normpdf的c++源码实现
正态分布的概率值输入:要求概率密度的点矩阵;aver—均值;sigma—标准差
输出矩阵点上的概率密度值
函数声明 Matrix normpdf(Matrix& x,double aver=0,double sigma=1); 函数定义 Matrix Matlab2c::normpdf(Matrix& a,double aver,double sigma) { Matrix p(a.row,a.column); for (int i=0;i<p.row;i++) for (int j=0;j<p.column;j++) p(i,j) = (double)(1.0/(std::sqrt(2*3.141592)*sigma)*std::exp(-(a(i,j)-aver)*(a(i,j)-aver)/(2*sigma*sigma))); return p; }
normpdf函数的使用测试
#include "Matlab2c.h" #pragma comment(lib,"Matlab2c.lib") using namespace Matlab2c;
int main()
{
double a[]={1,2,3,4,5,6};
Matrix aa=Matrix(2,3,a);
Matrix cc=Matlab2c::normpdf(aa,3,5);
cout<<cc.toString()<<endl;
system("pause");
return 0;
}
相关文章推荐
- matlab2c使用c++实现matlab函数系列教程-raylpdf函数
- matlab2c使用c++实现matlab函数系列教程-conv函数
- matlab2c使用c++实现matlab函数系列教程-randint函数
- matlab2c使用c++实现matlab函数系列教程-fliplr函数
- matlab2c使用c++实现matlab函数系列教程-angle函数
- matlab2c使用c++实现matlab函数系列教程-pascal函数
- matlab2c使用c++实现matlab函数系列教程-toeplitz函数
- matlab2c使用c++实现matlab函数系列教程-det函数
- matlab2c使用c++实现matlab函数系列教程-wilkinson函数
- matlab2c使用c++实现matlab函数系列教程-kron函数
- matlab2c使用c++实现matlab函数系列教程-find函数
- matlab2c使用c++实现matlab函数系列教程-repmat函数
- matlab2c使用c++实现matlab函数系列教程-sort函数
- matlab2c使用c++实现matlab函数系列教程-hankel函数
- matlab2c使用c++实现matlab函数系列教程-inv函数
- matlab2c使用c++实现matlab函数系列教程-cat函数
- matlab2c使用c++实现matlab函数系列教程-flipud函数
- matlab2c使用c++实现matlab函数系列教程-tril函数
- matlab2c使用c++实现matlab函数系列教程-eye函数
- matlab2c使用c++实现matlab函数系列教程-rot90函数