matlab概率论例子

  1. 高斯概率模型:
[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.

代码:

>> %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. 产生高斯样本点

代码:

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]

输出:
在这里插入图片描述

相关推荐

  1. 概率论基础

    2024-01-02 12:16:03       43 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-02 12:16:03       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-02 12:16:03       106 阅读
  3. 在Django里面运行非项目文件

    2024-01-02 12:16:03       87 阅读
  4. Python语言-面向对象

    2024-01-02 12:16:03       96 阅读

热门阅读

  1. ASIC与FPGA哪个前景好?FPGA有必要转ASIC吗?

    2024-01-02 12:16:03       68 阅读
  2. Vue中的keep-alive缓存组件的理解

    2024-01-02 12:16:03       52 阅读
  3. 12.26

    12.26

    2024-01-02 12:16:03      64 阅读
  4. c++ day4

    2024-01-02 12:16:03       44 阅读
  5. 微信小程序canvas手写签字

    2024-01-02 12:16:03       52 阅读
  6. C:宏:编程风格:井号与define之间的空格

    2024-01-02 12:16:03       59 阅读
  7. 将jupyter转换为python文件

    2024-01-02 12:16:03       58 阅读
  8. LeetCode 20. 有效的括号

    2024-01-02 12:16:03       56 阅读
  9. Android 10.0 截屏流程

    2024-01-02 12:16:03       47 阅读
  10. Atlas Hook 导入 Hive 元数据

    2024-01-02 12:16:03       52 阅读