matlab概率论例子

  1. 高斯概率模型:
bash 复制代码
[f,xi] = ksdensity(x): returns a probability density estimate, f, for the sample in the vector x. 
The estimate is based on a normal kernel function, and is evaluated at 100 equally spaced points, xi, that cover the range of the data in x.

代码:

bash 复制代码
>> %Give a random sample
x=[2*randn(6000,1); 5+randn(4000,1)];
%Calculate the probability density of each point
[f,xi]=ksdensity(x);
%plot
subplot(211);
plot(x);
title('Sample Data')
subplot(212);
plot(xi,f);
title('PDF');
>> 

图形:

  1. 产生高斯样本点

代码:

bash 复制代码
clear all;  clc;
N=6;
s01=randi([0,1],N,1); % 01 random sequence
s=2*s01-1;    % +1-1 random sequence
w=randn(N,1); % Gaussian distribution
x=rand(N,1);  % Uniform  distribution
[s01,s,w,x]

输出:

相关推荐
星夜离尘5615 小时前
MATLAB 采样混叠实验 20 Hz 和 80 Hz 为什么会得到相同数据
matlab·数据采集·信号处理·采样定理·混叠
weixin_3077791315 小时前
C++代码实现MATLAB中的fitrtree函数功能
开发语言·c++·算法·matlab
weixin_3077791317 小时前
C++代码实现MATLAB中的spectralcluster函数功能
开发语言·c++·算法·matlab
孙琦Ray17 小时前
开源MATLAB工具LIBquiv:650小时老化仿真仅139秒
matlab·开源·锂离子电池·等效电路模型·电池老化·libquiv·电池建模
Samson Bruce18 小时前
【数学之美】
线性代数·算法·概率论
phoenix@Capricornus18 小时前
LDA 协方差矩阵(MATLAB `fitcdiscr`)
算法·matlab·矩阵
星夜离尘561 天前
MATLAB 线性去趋势为何损伤低频正弦:联合最小二乘估计幅相与漂移
开发语言·matlab
思茂信息1 天前
电磁仿真学涉及哪些算法?
人工智能·算法·数学建模·matlab·emc·电磁仿真·仿真辐射
星夜离尘562 天前
MATLAB 定点量化误差实验 半个 LSB 的界限为什么挡不住削顶失真
开发语言·matlab
weixin_307779132 天前
C++代码实现MATLAB中的fitnlm函数功能
开发语言·c++·算法·matlab