Wednesday, 11 June 2014

画Beta分布图
X=0:0.01:1;

y1 = betapdf(X, 40, 40 );
figure;
plot(X,y1,'Color','g');

hold on;
y2 = betapdf(X,100,100);
plot(X,y2,'Color','r');

hold on;
y3 = betapdf(X,20,40);
plot(X,y3,'Color','b');

Friday, 6 June 2014

intersect 例子

INTERSECT(A,B) for vectors A and B, returns the values common to the two vectors. MATLAB sorts the results.  A and B can be cell arrays of strings.

For example, A=[1 2 3], B= [ 2 3 4]
The result of intersect(A,B) should be [2 3]

[dummy, indexA, indexB] = intersect(A,B)

dummy = [2 3]
indexA = [1 2]
indexB = [2 3]