I have a bunch of points generated by a for loop,I want to plot a curve through connecting this points.. connecting by line segments can also work…
program is like this:
function [output] = simulation(l1,l2,l3,l4,l5,l6)for t = 1:1:360 x1=l2*cosd(t); y1=l2*sind(t); r2 = sqrt(l1^2+l2^2-(2*l1*l2*cosd(t))); t1=atan2d( sqrt(1- ((l3^2 +l4^2 - r2^2 )/(2*l3*l4))^2),(l3^2 +l4^2 - r2^2 )/(2*l3*l4)); t8=atan2d(l2*sin(t)+l4*sin(t1),(l3+l1-l2*cosd(t)-l4*cosd(t1))); t4=360+2*atan2d((l2*sind(t) - l3*sind(t1)),(l4-l1+l2*cosd(t) - l3*cosd(t1))); x2= l2*cosd(t)+l3*cosd(t8); y2=l2*sind(t)+l3*cosd(t8); x3=l1; t6 = atan2d(sqrt(1-((l3^2+l5^2-l6^2)/(2*l3*l5))^2),(l3^2+l5^2-l6^2)/(2*l3*l5)); t11=t6+t8; x5=l2*cosd(t)+l5*cosd(t11); y5=l2*sind(t)+l5*sind(t11); %{ plot([x1,0],[y1,0]); hold on; plot([x1,x2],[y1,y2]); hold on; plot([x3,x2],[0,y2]); hold on; plot([x3,0],[0,0]); hold on; plot([x1,x5],[y1,y5]); hold on; plot([x2,x5],[y2,y5]); hold on; %} plot(x5,y5,'.'); <---- This statement generate a bunch of points. hold on; end
Best Answer