Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

1D two linear 2-node element solver

2 Ansichten (letzte 30 Tage)
John Adams
John Adams am 14 Mai 2023
Geschlossen: John D'Errico am 18 Jun. 2023
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 Kommentare
Dyuman Joshi
Dyuman Joshi am 14 Mai 2023
Please show what you have attempted yet.
John Adams
John Adams am 14 Mai 2023
Bearbeitet: John Adams am 14 Mai 2023
% 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.

Antworten (0)

Diese Frage ist geschlossen.

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by