Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

1D two linear 2-node element solver

조회 수: 2 (최근 30일)
John Adams
John Adams 2023년 5월 14일
마감: John D'Errico 2023년 6월 18일
Hello Everyone,
I am a beginner in matlab and trying to learn fem codding. Can someone help me to solve Problem 4.4 in "A First Course in Finite Elements: Fish, Jacob, Belytschko, Ted" book?
Thank you for your help.
  댓글 수: 2
Dyuman Joshi
Dyuman Joshi 2023년 5월 14일
Please show what you have attempted yet.
John Adams
John Adams 2023년 5월 14일
편집: John Adams 2023년 5월 14일
% Define the number of elements
numElements = [2, 4, 8];
% Define the exact displacement function
u_ex = @(x) x.^3;
% Initialize arrays to store the errors and element sizes
errors = zeros(size(numElements));
elementSizes = zeros(size(numElements));
% Iterate over different mesh configurations
for i = 1:numel(numElements)
numElems = numElements(i);
elementSize = 1 / numElems;
% Subdivide the interval [0, 1] into elements
x = linspace(0, 1, numElems + 1);
% Initialize arrays for storing the displacements and strains
u_h = zeros(size(x)); epsilon_h = zeros(size(x));
epsilon_ex = zeros(size(x));
% Iterate over each element
for e = 1:numElems
% Define the element nodes
x1 = x(e); x2 = x(e + 1);
% Define the element shape function matrix
N_e = [(x2 - x) / (x2 - x1); (x - x1) / (x2 - x1)];
Actually, I am a bit confused about steps which one I need to do first etc. I know some theoretical aspects like when I compute displacement at 2nd node of 2nd element I should not use 1st element 1st shape function but I could not turn it into code. I need a solution of this example to better understand to topic. Please help, thank you.

답변 (0개)

이 질문은 마감되었습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by