i have a project to write a script to give the height a cam pushes up a follower from the angle of the cam and then plot the graph of angle versus height. The radius of the cam is not uniform. i have written the code and have gotten y values but cannot plot these on a graph. any insight into what i am doing wrong? thanks!
Matlab codefor x=0: pi/20: 2*pi; %set up for loop for values between 0 and 2pi
if (x>=0)&&(x<=pi/2) y=6*(2*x-0.5*sin(x))/pielseif (x>=pi/2)&&(x<=2*pi/3) y=6;elseif (x>=2*pi/3)&&(x<=4*pi/3) y=6-3*(1-0.5*cos(3*(x-2*pi/3)))elseif (x>=4*pi/3)&&(x<=3*pi/2) y=3elseif(x>=3*pi/2)&&(x<=7*pi/4) y=3-1.5*((x-3*pi/2)/(pi/4))^2else (x>=7*pi/4)&&(x<=2*pi) y=0.75-0.75*(1-(x-7*pi/4)/(pi/4))^2endendplot(x,y)
Best Answer