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

版本 1.0.0.0 (1.4 KB) 作者: Sajeer Modavan
This code may help you to draw the shape function in Finite Element Analysis
244.0 次下载
更新时间 2015/12/1

查看许可证

% 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

引用格式

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. 检索时间: .

MATLAB 版本兼容性
创建方式 R2007b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Quadratic Programming and Cone Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0