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