Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
added hw2 work
- Loading branch information
Showing
13 changed files
with
235,189 additions
and
513 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
1,496 changes: 1,496 additions & 0 deletions
1,496
hw2_work/.ipynb_checkpoints/hw2_work-checkpoint.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
function dr=ode3(t,r,l,k,m) | ||
% first order ODE for pendulum attached to 2 springs | ||
% l is pendulum length | ||
% k is spring stiffness of one spring | ||
% m is mass of pendulum bob | ||
g=9.81; | ||
dr=zeros(size(r)); | ||
dr(1)=r(2); % dtheta/dt=dtheta/dt | ||
dr(3)=r(4); % dy/dt=dy/dt | ||
if abs(r(1))<=0.2 | ||
dr(2)=-2*k*g/(2*k*l+m*g)*r(1); | ||
dr(4)=-2*k/m*r(3); | ||
else | ||
ddy=1/l*1/sin(r(1))^2*[1 -cos(r(1));-l*cos(r(1)) l]*[-g*sin(r(1));-2*k/m*r(3)]; | ||
dr(2)=ddy(1); | ||
dr(4)=ddy(2); | ||
end | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function dr=ode4(t,r,k,m) | ||
% first order ODEs for two masses attached by a linear spring | ||
% k is spring stiffness (assume le=0) | ||
% m is mass of each | ||
dr=zeros(size(r)); | ||
dr(1)=r(2); | ||
dr(3)=r(4); | ||
dr(2)=r(1).*r(4).^2-2*k/m*r(1); | ||
dr(4)=-2*r(2).*r(4)./(r(1)); | ||
end |
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.