Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
Include Page
SIMULATION: MATLAB Google AnalyticsSIMULATION:
MATLAB Google Analytics
Include Page
SIMULATION: Structures and Handles - PanelSIMULATION:
Structures and Handles - Panel

...

We'll create the above structure by modifying the code from Step 1. Recall that the statements for creating the structure were

Wiki Markup{{eps_val = \ [2 7 4\]; %Nonsense values}} {{
R = 2*eye(3); %Dummy R}} {{
sig_val = (R*eps_val')'; %Derived nonsense}} {{
sigepsstruct = struct('eps', eps_val, ...}} {{
'sig', sig_val);}}

We have to create a second row for the eps and sig fields, corresponding to values for the second element. We can do this by looping over the elements, adding one row at a time.

...

We will keep the R matrix calculation out of the loop (since it doesn't need to be recalculated each time anew). This leaves us with the eps_val, sig_val and sigepsstruct statements inside the loop. In a real calculation, the strain values for each element , or equivalently, the rows of the eps field, are going to be different. To make the rows of the epsfield different, we'll blithely multiply each row by the loop counter. This is again done to explain programming concepts; it makes no sense from a solid mechanics sense.

Wiki Markup{{numels = 2;%Total number of elements}} {{
R = 2*eye(3); %Dummy R}} {{
for iele = 1:numels}} {{   eps
   eps_val = iele*\[2 7 4\]; %Nonsense values}} {{   sigvalues
   sig_val = (R*eps_val')'; %Derived nonsense}} {{end}}
end

Another thing: eps_val and sig_val above are row vectors. But the epsfield is a matrix. We'll create this matrix as follows: after each row of the matrix is calculated, we will "push" it into the appropriate row of the matrix. Let's call this matrix geps_val, the g prefix standing for global. The following assignment will push the current eps_val vector into the second row of the matrix.

...