matlab2c使用c++实现matlab函数系列教程-normpdf函数
来源:互联网 发布:linux socket多线程 编辑:程序博客网 时间:2024/06/03 04:10
全栈工程师开发手册 (作者:栾鹏)
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;}
阅读全文
1 0
- matlab2c使用c++实现matlab函数系列教程-normpdf函数
- matlab2c使用c++实现matlab函数系列教程-blkdiag函数
- matlab2c使用c++实现matlab函数系列教程-compan函数
- matlab2c使用c++实现matlab函数系列教程-eye函数
- matlab2c使用c++实现matlab函数系列教程-hankel函数
- matlab2c使用c++实现matlab函数系列教程-hilb函数
- matlab2c使用c++实现matlab函数系列教程-ones函数
- matlab2c使用c++实现matlab函数系列教程-zeros函数
- matlab2c使用c++实现matlab函数系列教程-pascal函数
- matlab2c使用c++实现matlab函数系列教程-toeplitz函数
- matlab2c使用c++实现matlab函数系列教程-wilkinson函数
- matlab2c使用c++实现matlab函数系列教程-diag函数
- matlab2c使用c++实现matlab函数系列教程-tril函数
- matlab2c使用c++实现matlab函数系列教程-triu函数
- matlab2c使用c++实现matlab函数系列教程-fliplr函数
- matlab2c使用c++实现matlab函数系列教程-flipud函数
- matlab2c使用c++实现matlab函数系列教程-reshape函数
- matlab2c使用c++实现matlab函数系列教程-rot90函数
- Leetcode(W1):169.Majority Element
- 【LeetCode】4.Median of Two Sorted Arrays
- 根据一个点获取窗口句柄的API
- 257. Binary Tree Paths
- 数据库连接Java
- matlab2c使用c++实现matlab函数系列教程-normpdf函数
- 【BZOJ1426】收集邮票 期望DP
- js正则中\b的用法
- 本无完美
- Android--(6)--详解ImageButton属性
- 2017-09-10 LeetCode_017 Letter Combinations of a Phone Number
- 算法分析与设计丨第一周丨LeetCode(2)——Different Ways to Add Parentheses(Medium)
- anaconda 中查看库的版本号
- matlab2c使用c++实现matlab函数系列教程-exprnd函数