Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

1D two linear 2-node element solver

2 visualizzazioni (ultimi 30 giorni)
John Adams
John Adams il 14 Mag 2023
Chiuso: John D'Errico il 18 Giu 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 Commenti
Dyuman Joshi
Dyuman Joshi il 14 Mag 2023
Please show what you have attempted yet.
John Adams
John Adams il 14 Mag 2023
Modificato: John Adams il 14 Mag 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.

Risposte (0)

Questa domanda è chiusa.

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by