plotted two different dataset如何在MATLAB
繪製線性決策邊界我有2個不同的數據集具有不同的mu和sigma,和X載體如[1.8; 1.8。而且我也知道每個類的概率P(ω1)= P(ω2)= 1/2 我想繪製這兩個數據集之間的線性決策邊界,但我沒有任何想法必須做。我的代碼是下面,這裏
X = [1.8; 1.8];
u1 = [1;1]; u2 = [3;3];
s1 = [1 0;0 1]; s2 = [1 0;0 1];
Pr1 = 1/2;
Pr2 = 1/2;
r = mvnrnd(u1,s1,500);
plot(r(:,1), r(:,2), '+r');
hold on
r = mvnrnd(u2,s2,500);
plot(r(:,1), r(:,2), '+b');
hold on
grid on
W1 = (u1')/(s1(1,1))^2;
W10 = (u1'*u1)/(-2*s1(1,1)) + log(Pr1);
g1 = W1'.*X + W10;
W2 = (u2')/(s2(1,1))^2;
W20 = (u2'*u2)/(-2*s2(1,1)) + log(Pr2);
g2 = W2'.*X + W20;
有沒有人可以給我任何想法給我?