Using Matrix inputs in Linecirc

2 views (last 30 days)
Cat
Cat on 12 Feb 2017
Hi, I have a series of points which make a curve, and wish to calculate the coordinates if i were to move the points perpendicularly 1mm up the y axis. I have found the perpendicular gradient (slope) and the associated intercept in Excel and input each of these as matrices. I have also input the original curve points as matrices.The radius does not change. I am not sure if I should use the "i=1:13" in a for-end loop, as this is giving me errors. I would greatly appreciate some help to solve this as my Matlab skills aren't too strong!
CODE_part1:
%r= radius of circle
%x_0= x co-ordinate of point on curve
%y_0= y co-ordinate of point on curve
%m= gradient of line between points
%m_p= gradient of perpendicular line to point
%c_p= y-intercept of line perpendicular to point
%xout= x co-ordinate of intersection of perpendicular line and circle
%yout= yco-ordinate of intersection of perpendicular line and circle
CODE_part2:
r=1;
x_0(i)=[0 243.48 490.29 737.11 985.51 1110.04 1235.54 1300.51 1362.05 1396.25 1430.44 1464.64 1488.57];
y_0(i)=[12 12.86294 14.13362 16.5784 23.222 29.108 39.305 48.9024 64.7942 80.1476 107.0434 168.7104 310];
CODE_part3:
m_p(i)=[-282.1517 -229.7926 -132.8585 -54.4894 -29.7639 -15.5462 -9.6224 -4.9633 -3.0642 -1.6187 -0.7722 -0.2864 -0.1694];
c_p(i)=[12.0000 55962.7552 65153.2692 40181.2298 29355.8619 17286.0440 11928.1879 6503.6958 4238.3206 2340.2978 1211.6583 588.2066 562.1168];
CODE_part4:
for i=1:13
[xout(i),yout(i)]=linecirc(m_p(i), c_p(i), x_0(i), y_0(i), r)
end
  1 Comment
Dimitrios Voulanas
Dimitrios Voulanas on 19 Oct 2019
Thy this:
r=1;
x_0=[0 243.48 490.29 737.11 985.51 1110.04 1235.54 1300.51 1362.05 1396.25 1430.44 1464.64 1488.57];
y_0=[12 12.86294 14.13362 16.5784 23.222 29.108 39.305 48.9024 64.7942 80.1476 107.0434 168.7104 310];
m_p=[-282.1517 -229.7926 -132.8585 -54.4894 -29.7639 -15.5462 -9.6224 -4.9633 -3.0642 -1.6187 -0.7722 -0.2864 -0.1694];
c_p=[12.0000 55962.7552 65153.2692 40181.2298 29355.8619 17286.0440 11928.1879 6503.6958 4238.3206 2340.2978 1211.6583 588.2066 562.1168];
for i=1:13
[xout(i,:),yout(i,:)]=linecirc(m_p(i), c_p(i), x_0(i), y_0(i), r);
end
Hope it helps!

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!