Drawing Shape Function of Quadratic element (1D) or Beam element
% This code can use for ploting shape function of
% Quadratic Element (One Dimensional Problem)
% Beam element
clc; clear all; close all
x_e = 0;
h_e = 1;
Phi_0 = zeros(10,1);
Phi_1 = zeros(10,1);
Phi_2 = zeros(10,1);
Phi_3 = zeros(10,1);
Phi_4 = zeros(10,1);
Case = input('Type 1 for Quadratic Element (1D), Type 2 for Beam Element ');
n = 0;
if Case == 1
% Quadratic Element (1D Problem)
for x = 0:.1:1
n = n+1;
phi_1 = (1-(x)/h_e)*(1-(2*x)/h_e);
phi_2 = 4*(x)/h_e*(1-(x)/h_e);
phi_3 = -(x)/h_e*(1-(2*x)/h_e);
Phi_0(:,n) = 0; % This Draws axis line
Phi_1(:,n) = phi_1;
Phi_2(:,n) = phi_2;
Phi_3(:,n) = phi_3;
end
plot (0:.1:1,Phi_1','c')
hold on
plot (0:.1:1,Phi_2','g')
plot (0:.1:1,Phi_3','r')
plot (0:.1:1,Phi_0','k')
else
% Beam element
for x = 0:.1:1
n = n+1;
phi_1 = 1-3*((x-x_e)/h_e).^2+2*((x-x_e)/h_e).^3;
phi_2 = -(x-x_e)*(1-((x-x_e)/h_e)).^2;
phi_3 = 3*((x-x_e)/h_e).^2-2*((x-x_e)/h_e).^3;
phi_4 = -(x-x_e)*(((x-x_e)/h_e).^2-((x-x_e)/h_e));
Phi_0(:,n) = 0; % This Draws axis line
Phi_1(:,n) = phi_1;
Phi_2(:,n) = phi_2;
Phi_3(:,n) = phi_3;
Phi_4(:,n) = phi_4;
end
plot (0:.1:1,Phi_1','c')
hold on
plot (0:.1:1,Phi_2','g')
plot (0:.1:1,Phi_3','r')
plot (0:.1:1,Phi_4','b')
plot (0:.1:1,Phi_0','k') % This Draws axis line
end
Cita come
Sajeer Modavan (2025). Drawing Shape Function of Quadratic element (1D) or Beam element (https://it.mathworks.com/matlabcentral/fileexchange/54253-drawing-shape-function-of-quadratic-element-1d-or-beam-element), MATLAB Central File Exchange. Recuperato .
Compatibilità della release di MATLAB
Compatibilità della piattaforma
Windows macOS LinuxCategorie
Tag
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Scopri Live Editor
Crea script con codice, output e testo formattato in un unico documento eseguibile.
| Versione | Pubblicato | Note della release | |
|---|---|---|---|
| 1.0.0.0 |
