Plotting deflection of beam using macaulay functions

I am trying to plot the deflection of a beam under bending forces. My understanding is to use the heaviside function but i am having trouble plotting these points. An example of this function would be: slope=(1/(E*I))*(146.5*<x>^2+315<x-0.12>^2-70.24*,x.^3)

3 Comments

Umar
Umar on 29 Jul 2024
Edited: Umar on 29 Jul 2024

Hi @Benjamin,

You mentioned in your posted form, “trying to plot the deflection of a beam under bending forces”

Please see my response to your comment below.

To illustrate it with example code snippet, define beam properties by setting the length of the beam L, Young's modulus of the beam material E, moment of inertia of the beam cross-section I, and the distributed load on the beam w. Then, create a vector of positions by creating a vector x representing positions along the beam using linspace from 0 to L with 1000 points, then deflection at each position is calculated using the formula for beam deflection under bending forces. Finally plot the deflection profile using plot, labeling the axes, adding a title, and displaying a grid for better visualization. Please see attached plot.

% Define beam properties

L = 5; % Length of the beam (in meters)

E = 2.1e11; % Young's modulus of the beam material (in Pascals)

I = 4.5e-5; % Moment of inertia of the beam cross-section (in meters^4)

w = 1000; % Distributed load on the beam (in Newtons per meter)

% Create a vector of positions along the beam

x = linspace(0, L, 1000);

% Calculate the deflection at each position

deflection = (w/(24*E*I)) * x.^2 .* (x.^2 - 4*L*x + 6*L^2);

% Plot the deflection profile

plot(x, deflection);

xlabel('Position along the beam (m)');

ylabel('Deflection (m)');

title('Beam Deflection Profile');

grid on;

Hope this will help resolve your problem now.

This code does not allow for the macaulay function to be considered, I managed to plot my shear force and bending moment diagrams fine but not the deflection and slope diagrams. What I plan to do is derive equations for each section of the beam on the same set if axes so the macaula functions wont be needed however to plot this in one plot function would be way preffered.
@Benjamin, if you still have any further questions, please let me know.

Sign in to comment.

Answers (1)

You wrote:
"An example of this function would be: slope=(1/(E*I))*(146.5*<x>^2+315<x-0.12>^2-70.24*,x.^3)"
I interpret that to mean
I am not sure where you want to apply the heaviside function, and I do not know the range for x.
Example: A beam of length 1 is supported at x=0, x=0.4, and x=1. The deflection is given by
y=(x-0.2)^2-0.04 for x=0 to 0.4
and by
y=2*(x-0.7)^2-0.09 for x=0.4 to 1.0.
Plot the deflection (y) versus position (x), the easy way, and using heaviside functions.
Easy way:
x1=0:.01:.4;
y1=(x1-0.2).^2-0.04;
x2=0.4:0.01:1.0;
y2=(x2-0.7).^2-0.09;
figure;
subplot(211), plot(x1,y1,'-r.',x2,y2,'-b.'); xlabel('x'); ylabel('y'); grid on
Heaviside way:
x=0:.01:1;
y=heaviside(0.4-x).*((x-0.2).^2-0.04)+heaviside(x-0.4).*((x-0.7).^2-0.09);
subplot(212); plot(x,y,'-g.'); xlabel('x'); ylabel('y'); grid on
Good luck.

1 Comment

The basic idea for using heaviside functions is:
Suppose for , and for .
Then we can write a single function for y(x) using the heaviside function, h():
which we implement in matlab with
y=fR(x).*heaviside(xc-x)+fL(x).*heaviside(x-xc);
where x is a vector covering the full range of x.
If y has three functions, which apply in three different regions, then proceed as above, and use two heaviside functions in the middle region, to turn on and turn off the middle function at the appropriate values of x.
For example, if is the active function from , and fL and fR apply on the left and right sides, then multiply by two heaviside functions:
y=fR(x).*heaviside(xc1-x)+...
fmid(x).*heaviside(x-xc1).*heaviside(xc2-x)+...
fL(x).*heaviside(x-xc2);
Good luck.

Sign in to comment.

Categories

Find more on Graphics Performance in Help Center and File Exchange

Products

Release

R2022b

Asked:

on 29 Jul 2024

Commented:

on 18 Aug 2024

Community Treasure Hunt

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

Start Hunting!