Effacer les filtres
Effacer les filtres

I have a straight line(X1,Y1) (X2,Y2). I want to know the coordinates of all the points present on the straight line. I have another random line along the straight line. I have to calculate the Mean Squared Error between the two lines. How do i do it

1 vue (au cours des 30 derniers jours)
I have a straight line(X1,Y1) (X2,Y2). I want to know the coordinates of all the points present on the straight line. I have another random line along the straight line. I have to calculate the Mean Squared Error between the two lines. How do i do it?
  2 commentaires
Stephen23
Stephen23 le 15 Fév 2017
"I want to know the coordinates of all the points present on the straight line"
There are infinite points between any two points on that line. How do you hope to store infinite points on your computer?
MoonPie1
MoonPie1 le 17 Fév 2017
I would want to store the points present at 0.25mm gap.

Connectez-vous pour commenter.

Réponse acceptée

KSSV
KSSV le 17 Fév 2017
p1 = [0 0] ;
p2 = [1 2] ;
% get slope
m = (p2(2)-p1(2))/(p2(1)-p1(1)) ;
% get between points
xi = p1(1):0.01:p2(1) ;
yi = p1(2)+m*(xi-p1(1)) ;
figure
p12 = [p1 ;p2] ;
plot(p12(:,1),p12(:,2),'r')
hold on
plot(xi,yi,'.b')

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by