Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the dynamic graph method of drawing binomial distribution by matlab python?

2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "what is the dynamic graph method of matlab python drawing binomial distribution". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Matlab and Python are commonly used tools in data processing, probability theory is a very important foundation in quantitative model, and central limit theorem is a very important theory in probability theory.

The central limit theorem is defined as:

Let the random sequence {Xi} be independent and identically distributed, with a common mathematical expectation u and variance σ ^ 2.

Standardize the definition of Sn

Cymbals

Converge to the standard normal distribution according to the distribution. That is, for any x

Phellodendron mandshurica (Thunb.)

Phellodendron mandshurica (Thunb.)

Here Φ (x) is the distribution function of the standard normal distribution.

For binomial distribution

Cymbals

When n →∞, the distribution shape of Sn is very similar to that of normal distribution.

So, today we're going to look at the change in the shape of Sn as n grows up.

Matlab dynamic diagram:

Python dynamic diagram:

Matlab Code:

Clear all

Close all

Clc

%% binomial distribution

P = 0.6

N = 1000

Psn = zeros (1)

If 1

H3 = plot (0purn Psn)

Grid on

% axis ([0n 00.05])

Axis ([1 100 0 0.09])

For iTunes 100ln

For k = 0PUR I

Psn (KPY 1) = nchoosek (iMagol k) * (p ^ k) * ((1murp) ^ (iMurk))

End

Set (floor (iTunes 0.6)-50:floor (item0.6) + 50)

Drawnow

Grid on

Pause (0. 01)

End

End

Python Code:

#-*-coding: utf-8-*-

"

File Name: central_limit_theorem1.py

Description:

Author: Z270

Date: 2018-8-30

Change Activity:

2018-8-30:

"

Import numpy as np

From scipy.special import comb

Import matplotlib.pyplot as plt

P = 0.6

N = 1000

Psn = np.zeros (nasty 1)

Plt.figure (figsize= (8,6), dpi=80)

# turn on interactive mode

Plt.ion ()

For i in range (10010):

For k in range (iTun1):

Psn [k] = comb (imam k) * (pumped quok) * ((1MIML p) * * (iMel k))

Plt.cla ()

Plt.grid (True)

Plt.xlim (1100)

Plt.ylim (0Pol 0.09)

Plt.plot (range (1102), Psn [int (np.floor (0.6))-50:int (np.floor (0.6)) + 51], linewidth = 2.0)

Plt.pause (0.1)

Print (I)

Plt.ioff ()

The content of plt.show () "what is the dynamic graph method of matlab python drawing binomial distribution" is introduced here. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report