Good morning all
I'm trying to simulate an Euler-Bernoulli's pinned pinned beam response, subjected to harmonic force located at point 'a'.
I wrote the script:
clc; clear all
wi=10;L=100;th=0.5;I=(wi*th.^3)/12;A=wi*th;
rho=2400; E=41e+9; EI=E*I;
F=2000*9.81;
wf=1;
tmax=1;
tmin=0.1;
a=50;
w1=0;w2=0;w3=0;
hold all
for x=1:1:L
for t=tmin:tmax/10:tmax
for n=1:3
u=sin(n*pi*x/L);
ua=sin(n*pi*a/L);
F=F*sin(wf*t);
wn=(n*pi/L)^2*sqrt(EI/(rho*A));
w=((2/(rho*A*L))*(ua*u)/(wn^2-wf^2))*F;
if n==1
w1=w1+w;
elseif n==2
w2=w2+w;
elseif n==3
w3=w3+w;
end
end
end
end
hold off
What I want to achieve is to plot w (lateral displacement) with respect to x, and then with respect to t
The problem I have is how to sum up all the values of 'w', first for each 'n', and then for each 'x' ?
Let's say I'm dividing the length of the beam into 100 elements, so I'm expecting 100 summed up values of w?