Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Include Page
SIMULATION: MATLAB Google AnalyticsSIMULATION:
MATLAB Google Analytics
Panel

Overview
Step 1: Creating a structure for one element
Step 2: Creating a structure for two elements
Step 3: Structure of handles

...

Include Page
Structures and Handles - Panel
Structures and Handles - Panel

Creating a Structure for One Element

Background on Structures

Structures are a convenient way to organize data. To demonstrate how structures work, consider the triangular element below with three nodes, one at each corner.

...

In the above representation, sigepsstruct is refered to as a structure with two fields: eps and sig. A useful way to visualize this is that sigepsstruct is a box that contains two smaller boxes, eps and sig, which hold the strain and stress values, respectively. So if I want, say, the stress values, I ask MATLAB to open the sig box within sigepsstruct and look inside.

Create a structure

Let's create the above structure in MATLAB. Start MATLAB. Create a working directory at an appropriate location using the Current Directory window. If you cannot see this window, select Main Menu > Desktop > Current Directory. You can right-click in this window to access the option for creating a new folder (i.e. directory). Browse to this folder to make this your working directory.

...

We use "..." to start a new line. In order for this to work, we, of course, need to allocate strain and stress values to eps_val and sig_val, respectively, abovethis statement. We'll use dummy values that would horrify any self-respecting solid mechanics professor. We do so in order to make the programming aspects easier to understand.

Wiki Markup{{%Testing the use of structure}} {{
clear all; %Clear all variables from workspace}} {{
eps_val = \ [2 7 4\];%Nonsense values}} {{R = values
R = 2*eye(3); %Dummy R}} {{
sig_val = (R*eps_val')';%Derived nonsense}}

In your actual redAnTS implementation, the strains will be derived from the displacements that redAnTS provides from inversion of the stiffness matrix. And you'd have a meaningful R matrix. Note that we specify eps_val as a row vector; we have to use the transpose operator (') to ensure we end up with a row vector for sig_val also.

Save and run your M-file.

The Workspace window shows all the currently defined variables. If you don't see this window, select Main Menu > Desktop > Workspace so that a tick mark appears next to the window name. Double-click on any variable name in the Workspace to take a closer peek at it. Double-clicking on sigepsstruct shows the fields this structure contains.

...

I hear you saying "this is a piece of cake, gimme more!". So let's move on to Step 2.

Go to Step 2: Creating a structure for two elements

Go to all MATLAB Learning Modules