Skip to content
Permalink
8a917ec4de
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
14 lines (11 sloc) 515 Bytes
for i= 1:90
theta= i*pi/180; %define theta iteration
minimum_potential_energy= @(x_C) 0.5*(x_C)*9.81*sin(theta)+(1/2*1000)*(0.5 - sqrt(0.5^2+(0.5-x_C)^2))^2; %minimum potential energy
[C,fx,ea,iter]=goldmin(minimum_potential_energy,0,5,0.00001,50);
x_C(i)=C;
end
theta= 1:90; %define theta array
plot(theta,x_C,'.b') %plot the position of the collar rod for every subsequent theta value
xlabel 'theta' %X-Label
ylabel 'x_C' %Y-Label
title('Steady-state Position of Collar on Rod at Angle Theta')