
14-05-2008, 01:36 AM
|
|
عضو فعال جداً
|
|
تاريخ التسجيل: Oct 2006
المشاركات: 185
معدل تقييم المستوى: 0
|
|
السلام عليكم
سؤالك متعلق بالاحصاء وليس فكرة عن توزيع Bernoulli أو النوع الاخر لكن قرأت في Matlab help ووجدت بعض الايعازات أتمنى أن تستفيد منها
clear,clc
a = rand(500); % generating matrix (500x500) with random numbers between 0 and 1.
X = a(:,1); % take just the first column from the matrix so that we have 500 random numbers.
hist(X,500)
P = #; % write the value of P
N = #; % write the value of N
Z = BINOPDF(X,N,P); % generating binomial R.V. (please choose appropriate P and N)
[M,V] = binostat(N,P); % this function will give you the mean and the variance
figure(2),hist(Z)
P = 1; % P here should be 1 !!
N = #; % write the value of N
Y = BINOPDF(X,N,P); % generating Bernoulli R.V. (special case from binomial R.V. where P=1)
[M,V] = binostat(N,P); % this function will give you the mean and the variance
figure(3),hist(Y) % to plot the histogram
هذا ليس برنامج ولكن أيعازات يمكنك أن تستفاد منها في بناء برنامج
|