Permalink
Cannot retrieve contributors at this time
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?
roots_and_optimization/collar_potential_energy.m
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
15 lines (11 sloc)
481 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function totalPE = collar_potential_energy(x_C,theta) | |
% Solves the potential energy of a collar on a rod given initial position and angle. | |
% USAGE: totalPE = collar_potential_energy(x_C,theta) | |
m = 0.5; % mass is 0.5 kg | |
g = -9.81; % acceleration due to gravity | |
k = 30; % spring constant | |
PE_g= m*x_C*g*sind(theta); % potential energy due to gravity | |
DL = 0.5 - sqrt((0.5^2) - ((0.5-x_C).^2)); | |
PE_s = 0.5*k.*((DL).^2); % potentual energy due to spring | |
totalPE = PE_g + PE_s; | |
end |