フィルターのクリア

how i can draw full line in scatter plot?

1 回表示 (過去 30 日間)
mohammad nemat
mohammad nemat 2021 年 5 月 6 日
コメント済み: Scott MacKenzie 2021 年 5 月 6 日
clear all
close all
clc
x1=[0.1 ,1.1;
6.8 ,7.1;
-3.5,-4.1;
2,2.7;
4.1 ,2.8;
3.1 ,5;
-0.8,-1.3;
0.9 ,1.2;
5 ,6.4;
3.9 ,4 ;
];
x2=[7.1 ,4.2;
-1.4 ,-4.3;
4.5 , 0;
6.3 , 1.6 ;
4.2 , 1.9 ;
1.4 , -3.2;
2.4 , -4 ;
2.5 , -6.1;
8.4 , 3.7 ;
4.1 , -2.2;
];
[m,n]=size(x1);
w=double(zeros(1,n+1));
w=double([0,0,0]);
w=perceptron(x1,x2,w,0.5);
scatter(x1(:,1),x1(:,2),'r');
hold on;
scatter(x2(:,1),x2(:,2),'g');
axis([-4 9 -6 10]);
line([0,-w(3)/w(1)],[-w(3)/w(2),0], 'Color', 'b');
  1 件のコメント
Scott MacKenzie
Scott MacKenzie 2021 年 5 月 6 日
I have no idea about the overall goal, but you can use lsline after each scatter function. You'll get a best-fitting line for each data set and it will be a "full line".

サインインしてコメントする。

回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by