Drawing Shape Function of Quadratic element (1D) or Beam element

This code may help you to draw the shape function in Finite Element Analysis
242 téléchargements
Mise à jour 1 déc. 2015

Afficher la licence

% 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

Citation pour cette source

Sajeer Modavan (2024). Drawing Shape Function of Quadratic element (1D) or Beam element (https://www.mathworks.com/matlabcentral/fileexchange/54253-drawing-shape-function-of-quadratic-element-1d-or-beam-element), MATLAB Central File Exchange. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2007b
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Catégories
En savoir plus sur Quadratic Programming and Cone Programming dans Help Center et MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Publié le Notes de version
1.0.0.0