السلام عليكم
سجلت بالنتى لحاجتي القصوى بحل assignment
السؤال كالتالي مع محاولة اجابتي :
The purpose of the assignment is to create data belonging to two different classes according to the
specifications below. The figure above depicts two classes: red points belong to class 1; blue points
belong to class 0. The generated data should be of the form [(x,y),class]. The points are generated
randomly. However, x should always be between -1 and 4; y should be between -4 and 4. You should
generate 100 points for each class: 100 points for class 1 and 100 points for class 2. The data is stored
in a file.
- Create the two-class data so that the two classes are linearly separable. Plot the data to show
result graphically. - Create the two-class data so that the two classes are not linearly separable: typically, you will
have 20% of the generated data (for each class) violating the linear separability. Plot the data
to show result graphically.
What is required:
I. Generate the data for the two classes according to 1. and 2.
II. Plot the data (generated in 1. and 2.)
III. Explain how the data was generated
حــلي :
x=randint(200,1,[-1,4]);
y=randint(200,1,[-4,4]);
class=randsrc(200,1,[1 0,0.5 0.5]);
x=x';
y=y';
class=class';
axis([-1 4 -4 4]);
for i=1:200
if class(i)==1
hold on
plot(x(1,i),y(1,i),'d','MarkerFaceColor','g');
else
hold on
plot(x(1,i),y(1,i),'s','MarkerFaceColor','r');
end
end
بليييييز ساااعدووني اليووم ضروووري