Vibration of a Cantilever beam

18 views (last 30 days)
Bhanu Pratap Akherya
Bhanu Pratap Akherya on 25 Aug 2021
Answered: Umang Pandey on 19 Apr 2024 at 5:30
here is my main code:
clear all
clc
Ne=6;
l=1; %length
t=0.02; %thickness
b=0.02; %width
modulus=2e11; %(E)
area=b*t;
imoment=(b*((t)^3))/12;
Le=l/Ne; %length of element
Rho=7850; %density
%Element stiffness matrix
K1=(modulus*imoment/(Le^3))*[12,6*Le,-12,6*Le; ...
6*Le,4*Le*Le,-6*Le,2*Le*Le; ...
-12,-6*Le,12,-6*Le; ...
6*Le,2*Le*Le,-6*Le,4*Le*Le];
Kglobal=zeros(2*(Ne+1),2*(Ne+1));
M1=[156 22*Le 54 -13*Le;...
22*Le 4*Le*Le 13*Le -3*Le*Le;...
54 13*Le 156 -22*Le;...
-13*Le -3*Le*Le -22*Le 4*Le*Le]*(Rho*Le*b*t)/420;
Mglobal=zeros(2*(Ne+1),2*(Ne+1));
for ii=1:Ne
Kglobal(2*ii-1:2*(ii+1),2*ii-1:2*(ii+1))=Kglobal(2*ii-1:2*(ii+1),2*ii-1:2*(ii+1))+K1;
Mglobal(2*ii-1:2*(ii+1),2*ii-1:2*(ii+1))=Mglobal(2*ii-1:2*(ii+1),2*ii-1:2*(ii+1))+M1;
end
K=Kglobal;
K(1:2,:)=[];
K(:,1:2)=[];
M=Mglobal;
M(1:2,:)=[];
M(:,1:2)=[];
C=0.05*Kglobal;
C(1:2,:)=[];
C(:,1:2)=[];
K
M
C
u=(2*Ne)+1;
%dt=1/(max_freq*20);
dt=0.001;
T=300;
%Displacement initials
y0=zeros(2*(2*(Ne+1))-4,1);
% y0(1:2,:)=[];
% y0(u:u+1,:)=[];
y0(end-1,1)=0.5;
% t_array = a(1,:); % This is t array from xls file
F=xlsread('l&d.xlsx','O1:O300'); % This is F array from xls file
%% ode solver
for i = 1:length(F)
[tsol ysol]=ode15s(@(t, y) beam_function(t, y, F(i), K, M, C, u),[1:dt:T],y0);
end
ysol(:,u:end)=[];%eliminate velocity nodes 5001*12
size(ysol)
ii=1:2:(u-2); %eliminate angular displacement nodes
ysol(:,ii+1)=[]; %eliminating angular dis components
size(ysol)
%% plotting
plot(tsol,ysol(:,Ne))
here is my function
function [dy]=beam_function(t, y, F, K, M, C, u)
dy=[y(u:end);
M\(F-K*y(1:u-1)-C*y(u:end))]
Right now the force seems to be applied on the complete beam at once.
I want force (F) to be applied only on the last node, like the case of a cantilever beam. Can someone tell me a way how i can do that?

Answers (1)

Umang Pandey
Umang Pandey on 19 Apr 2024 at 5:30
Hi Bhanu,
To apply the force only on the last node of the beam, like in a cantilever beam scenario, you need to adjust the way the force is incorporated into your system of equations within the beam_function. Given that the force F is read from an Excel file and is intended to be applied at discrete time steps, you should construct a force vector that applies this force only to the last node.
Here's how you can modify your beam_function to apply the force only to the last node:
function [dy]=beam_function(t, y, F, K, M, C, u)
% Initialize force vector of size u-1 (since you've removed the first two DOFs)
F_vec = zeros(u-1, 1);
% Apply the force to the second last entry, which corresponds to the last node's displacement
% This is because the last entry would correspond to the rotation at the last node
F_vec(end-1, 1) = F;
% Dynamics equation
dy=[y(u:end);
M\(F_vec-K*y(1:u-1)-C*y(u:end))];
end
This adjustment ensures that the external force F (read from the Excel file at each time step) is applied only to the displacement of the last node, accurately simulating a cantilever beam subjected to a point load at its free end.
Best,
Umang

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!