I want to plot the shear and bending moment diagrams for a wing at diffrent load cases, given a symbolic vector for the lift distribution. I want to get something like this:
Is there a way I can do this?
Thank you!
Here is my script
clc
clear all
close all
%% Code for generating shear and bending moment diagrams for a wing generating lift at different load cases
b=3.75; % Wing span (m)
S=3.55; % wing area (m^2)
r=0.5; % Taper
Cr=1.27; %Root chord (m)
MAC=0.97; %Mean aerodynamic chord (m)
m_AO=15; %Wing mass
G=m_AO*9.81; %Wing weight
n1=3.8; %Load factor
%Total lift generated by wing for different load cases (N):
L=[890.19 1021.01 1279.12 -1935.61 -2267.18 -3242.27 2303.19 2665.21 3539.82 -3348.61 -3911.38 -5502.97]/2;
syms x
c=Cr*(1+2*(r-1)/b*x); %Chord distribution along wing
g_AO=n1*(G/b*c/MAC); %Wing weight distribution along wing
L_sch= L.*((Cr*(1+2*x/b*(r-1)))+((4/pi)*MAC*sqrt(1-(2*x/b).^2)))/2; %Vector for Schrenk lift distribution along wing
Tz=piecewise(x>0, int((L_sch-g_AO),x,x,b/2)); %Shear force symbolic vector
Mx=piecewise(x>0, int(-Tz,x,x,b/2)); %Bending moment symbolic vector
figure
plot(Tz, [0 b/2],linewidth=2)
title 'Shear force diagram'
ylabel('T_z [N]')
xlabel('Locația în semi-anvergură [m]')
grid on
box off
figure
fplot(Mx, [0,b/2],linewidth=2,Color='#D95319')
title 'Bending moment diagram'
ylabel('M_x [Nm]')
xlabel('Locația în semi-anvergură [m]')
grid on
box off

 Accepted Answer

You can remove the piecewise definition and use fplot from [0 b/2], then adjust the xlimits (and xticks) accordingly
clc
clear all
close all
%% Code for generating shear and bending moment diagrams for a wing generating lift at different load cases
b=3.75; % Wing span (m)
S=3.55; % wing area (m^2)
r=0.5; % Taper
Cr=1.27; %Root chord (m)
MAC=0.97; %Mean aerodynamic chord (m)
m_AO=15; %Wing mass
G=m_AO*9.81; %Wing weight
n1=3.8; %Load factor
%Total lift generated by wing for different load cases (N):
L=[890.19 1021.01 1279.12 -1935.61 -2267.18 -3242.27 2303.19 2665.21 3539.82 -3348.61 -3911.38 -5502.97]/2;
syms x
c=Cr*(1+2*(r-1)/b*x); %Chord distribution along wing
g_AO=n1*(G/b*c/MAC); %Wing weight distribution along wing
L_sch= L.*((Cr*(1+2*x/b*(r-1)))+((4/pi)*MAC*sqrt(1-(2*x/b).^2)))/2; %Vector for Schrenk lift distribution along wing
Tz=int((L_sch-g_AO),x,x,b/2);
%Shear force symbolic vector
Mx=int(-Tz,x,x,b/2); %Bending moment symbolic vector
figure
fplot(Tz, [0 b/2], '-.', 'LineWidth', 1.5) %%Added line style and modified line width
title 'Shear force diagram'
ylabel('T_z [N]')
xlabel('Locația în semi-anvergură [m]')
grid on
box off
%You can similarly modify ylimits and yticks as required
xlim([-0.25 2])
xticks(-0.25:0.25:2)
figure
fplot(Mx, [0,b/2],linewidth=2,Color='#D95319')
title 'Bending moment diagram'
ylabel('M_x [Nm]')
xlabel('Locația în semi-anvergură [m]')
grid on
box off
xlim([-0.25 2])
xticks(-0.25:0.25:2)

2 Comments

Thank you very much for the quick response! Much appreciated!
You are welcome!

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!