Clear Filters
Clear Filters

How to plot shear flow in a cross section?

22 views (last 30 days)
I have the following cod for the shear flow, but I don't know how to make a plot similar to the one provided in the image. Could you please help me finish the code and plot the shear flow in a given cross section. The cross section is provided on the second figure.
%% Shear flow plot
clear, clc
%Define symbolic variables
syms E v L a t1 t2 h P x y z s1 s2 s3 q2
%Defining the parameters
E=220000.0; %Young's Modulus [N/mm2]
v=0.3; %Poisson's Ratio
L=500.0; %Length of the z-shaped stiffener [mm]
a=20.0; %Length of the z-section rectangle [mm]
t1=2.0; %Thickness of the mid z-section rectangle [mm]
t2=2.0; %Thickness of the z-section rectangle ends [mm]
h=40.0; %Height of the mid z-section rectangle [mm]
P=200.0; %Applied load [N]
%Second moment of area calculation%
I_xx = ((t1*(h+2*t2)^3)/12)+2*((a*t2^3)/12+(a*t2*((h+t2)/2)^2));
I_yy = (((h+2*t2)*t1^3)/12)+2*((t2*a^3)/12+(a*t2*((t1+a)/2)^2));
I_xy = (a*t2*(h+t2)*(a+t1))/2;
%Shear flow Flange 12%
q_12 = (-P*I_xy/(I_xx*I_yy-I_xy^2))*(I_xy*(int(t2*x, s1, 0, s1))-I_yy*(int(t2*y, s1, 0, s1)));
q_12_sub = subs(q_12, [x y], [(s1-(a+t1/2)),(h/2+t2)]);
q2 = subs(q_12_sub, [s1], [(a+t1/2)]);
%Shear flow Web 23%
q_23 = (-P*I_xy/(I_xx*I_yy-I_xy^2))*(I_xy*(int(t1*x, s2, 0, s2))-I_yy*(int(t1*y, s2, 0, s2))+q2);
q_23_sub = subs(q_23, [x y], [0,(-s2+(h/2+t2))]);
%Shear flow Flange 34%
q_34 = (-P*I_xy/(I_xx*I_yy-I_xy^2))*(I_xy*(int(t2*x, s3, 0, s3))-I_yy*(int(t2*y, s3, 0, s3)));
q_34_sub = subs(q_34, [x y], [(s3+(a+t1/2)),(-(h/2+t2))]);

Answers (1)

Shivam Lahoti
Shivam Lahoti on 29 Dec 2023
Hi Elizaveta,
I can understand that you want to plot the shear flow in a given cross-section of a z-shaped stiffener. You have calculated the flow for each plane and need to plot them together as it appears in the first figure.
Please refer to the code below to understand how you can proceed with plotting the same using the ‘plot3’ function.
% Define ranges for s1, s2, and s3
s1_range = linspace(0, a, 100);
s2_range = linspace(0, h, 100);
s3_range = linspace(0, a, 100);
% Evaluate the shear flow expressions along the paths
q12_values = double(subs(q_12_sub, s1, s1_range));
q23_values = double(subs(q_23_sub, s2, s2_range));
q34_values = double(subs(q_34_sub, s3, s3_range));
% Create 3D coordinates for each section % Flange 12 (bottom flange)
x12 = s1_range; % Along the length of the flange
y12 = -(h/2 + t2) * ones(size(s1_range)); % Width of the flange is constant
z12 = q12_values; % Shear flow values
% Web 23 (vertical web)
x23 = a * ones(size(s2_range)); % Along the edge of the web
y23 = linspace(-(h/2 + t2), (h/2 + t2), 100); % Height of the web
z23 = q23_values; % Shear flow values
% Flange 34 (top flange)
x34 = a - s3_range; % Along the length of the flange from the end of web 23
y34 = (h/2 + t2) * ones(size(s3_range)); % Width of the flange is constant
z34 = q34_values; % Shear flow values
% Combine the coordinates and values for continuity
X = [x12, x23, x34];
Y = [y12, y23, y34];
Z = [z12, z23, z34];
% Plot the shear flow distribution in 3D
figure;
plot3(X, Y, Z, 'LineWidth', 2);
title('Continuous 3D Shear Flow Distribution in Z-shaped Stiffener');
xlabel('Length along the stiffener (mm)');
ylabel('Height along the stiffener (mm)');
zlabel('Shear Flow (N/mm)');
grid on;
view(3); % Set the view to 3D
I hope this was helpful.
Regards,
Shivam Lahoti.

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!