分布matlab怎么写

1.如何用matlab绘制分布图(如正太分布之类)没有用过直接画正态分布图的函数
不过我给你说个方法
有期望直为a,方差为b,可以把正态分布的函数表达式写出来,然后用plot(或者plot3,ezplot)函数画函数的图形,这样得到的也是正态分布图形
给你举个例子:
>> x=3+randn(500,1);
>> mean(x)
ans =
2.9648
>> std(x)
ans =
1.0134
>> y=normpdf(x,3,1);
>> plot(x,y,'.')
2.正态分布的密度函数用matlab怎么写啊MATLAB里有直接的函数 。调用语法如下:(正态分布又被称为高斯分布)
y = gaussmf(x,[sig c])
其中x是变量,sig就是你图片里的σ,而c就是你图片里的μ,比如:
下面是一个例子,你可以直接复制到MATLAB中运行就可以得到一个方差为2,均值为5的正态分布函数了:
x=0:0.1:10;
y=gaussmf(x,[2 5]);
plot(x,y)
xlabel('gaussmf, P=[2 5]')
3.matlab怎么画正态分布图x = (0:0.02:10);
y = lognpdf(x,1.73,0.22);
figure,subplot(121);
plot(x,y);
grid;
xlabel('x'); ylabel('p')
%这是对数正态分布
x = (0:0.02:10);
y = normpdf(x,1.73,0.22);
subplot(122);
plot(x,y);
grid;
xlabel('x'); ylabel('p')
%这是正态分布
4.急~~~~标准正态分布的Q函数用 matlab 怎么写Matlab中本身有Q函数,即qfunc() 其反函数是qfuncinv()
--------------------------------
help qfunc
qfunc
Q function
Syntax
y = qfunc(x)
Description
y = qfunc(x) is one minus the cumulative distribution function of the standardized normal random variable, evaluated at each element of the real array x. For a scalar x, the formula is
The Q function is related to the complementary error function, erfc, according to
Examples
The example below computes the Q function on a matrix, element by element.
x = [0 1 2; 3 4 5];
format short e % Switch to floating point format for displays.
y = qfunc(x)
format % Return to default format for displays.
The output is below.
y =
5.0000e-001 1.5866e-001 2.2750e-002
1.3499e-003 3.1671e-005 2.8665e-007
--------------------------------------------
help qfuncinv
qfuncinv
Inverse Q function
Syntax
y = qfuncinv(x)
Description
y = qfuncinv(x) returns the argument of the Q function at which the Q function's value is x. The input x must be a real array with elements between 0 and 1, inclusive.
For a scalar x, the Q function is one minus the cumulative distribution function of the standardized normal random variable, evaluated at x. The Q function is defined as
The Q function is related to the complementary error function, erfc, according to
Examples
The example below illustrates the inverse relationship between qfunc and qfuncinv.
x1 = [0 1 2; 3 4 5];
y1 = qfuncinv(qfunc(x1)) % Invert qfunc to recover x1.
x2 = 0:.2:1;
y2 = qfunc(qfuncinv(x2)) % Invert qfuncinv to recover x2.
The output is below.
y1 =
0 1 2
3 4 5
y2 =
【分布matlab怎么写】0 0.2000 0.4000 0.6000 0.8000 1.0000