Skip to content

update #10

Merged
merged 2 commits into from
Mar 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion HW4/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Homework #3
# Homework #4
## due 3/1/17 by 11:59pm


Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Computational Mechanics
## ME 3255 Spring 2017
### Github page: [https://github.uconn.edu/rcc02007/ME3255S2017.git]
### Public (ipynb rendering)[https://github.com/cooperrc/ME3255S2017]

### Course Description
This course introduces students to scientific programming utilizing Matlab/Octave.
Expand Down
366 changes: 366 additions & 0 deletions lecture_01/lecture_01.ipynb

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions lecture_02/lecture_02.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 21,
"metadata": {
"collapsed": false
},
Expand All @@ -18,15 +18,12 @@
"name": "stdout",
"output_type": "stream",
"text": [
"ans =\n",
"\n",
" 1 2 3\n",
"\n"
"ans = 14\r\n"
]
}
],
"source": [
"[1,2,3]"
"[1,2,3]*[1;2;3]"
]
},
{
Expand Down
913 changes: 913 additions & 0 deletions lecture_04/lecture_4.ipynb

Large diffs are not rendered by default.

Binary file modified lecture_13/octave-workspace
Binary file not shown.
6 changes: 6 additions & 0 deletions lecture_15/.ipynb_checkpoints/lecture_15-checkpoint.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 2
}
56 changes: 56 additions & 0 deletions lecture_15/animate_eig.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
function [v,e]=animate_eig(k,m)
% create a series of png's for use in an animation based on
% spring constants [k1,k2,k3]=k
% and
% masses
% [m1,m2]=m

% check inputs for m and k
if length(m)==1
m1=m;
m2=m;
else
m1=m(1);
m2=m(2);
end
if length(k)==1
k1=k; k2=k; k3=k;
else
k1=k(1);
k2=k(2);
k3=k(3);
end
setdefaults
K=[k1/m1+k2/m1,-k2/m1;-k3/m2,k2/m2+k3/m2];
[v,e]=eig(K);
w1=e(1,1); w2=e(2,2);
scale = 0.5; % the magnitude of oscillations is not important for vibrational modes
% just set scale to 1/2 for nice plots
% the eigenvector magnitude is independent of the solution
X11=v(1,1)*scale; X12=v(2,1)*scale;
X21=v(1,2)*scale; X22=v(2,2)*scale;
f11=@(t) X11*sin(w1*t); f12=@(t) X12*sin(w1*t);
f21=@(t) X21*sin(w2*t); f22=@(t) X22*sin(w2*t);
f=figure();
time=linspace(-1,4);
% create a loop to plot the position over time where mass 1 and 2 start at x=1 and x=2 m
% then for the next vibrational mode, mass 1 and 2 start at x=3 and x=4 m

for i=1:length(time)
t=time(i);
plot(f11(t)+1,0,'rs',f11(time+t)+1,-time,...
f12(t)+2,0,'rs',f12(time+t)+2,-time,...
f21(t)+3,0,'bo',f21(time+t)+3,-time,...
f22(t)+4,0,'bo',f22(time+t)+4,-time)
axis([0 6 -4 1])
title('Vibration Modes')
xlabel('position (m)')
ylabel('time (s)')
filename=sprintf('output/%05d.png',i);
% another option for saving a plot to a png is the 'print' command
print(filename)
end
% this is a system command to use ImageMagick's cli 'convert' to create an animated gif
% if you don't have ImageMagick installed, comment this next line
system ("convert -delay 10 -loop 0 output/*png eigenvalues.gif")
end
Binary file added lecture_15/eig_200_100_40_20.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lecture_15/eig_200_100_40_50.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lecture_15/eig_200_40.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.