%ECE 2290_MATLAB %cardioid/spiral intersection %B.Mobasseri, 2/18/98 %generate and plot the cardioid and spiral t=0:pi/180:2*pi-pi/180; r1=1+cos(t); r2=t/(2*pi); polar(t,r1,'r'); hold polar(t,r2,'b') %to find out where they meet, find where r1=r2 equal=[r1==r2]; %since we are in discrete space, r1 is never equal to r2 diff=[r1'-r2']; %diff will never be exactly zero but it has a minimum %i.e. where r1 comes closests to r2( disregard the sign of %r1-r2) [diff_min,position]=min(abs(diff)) %position is the location in the angle array t %where diff is minimum %convert to angle angle=t(position)*180/pi