# MATLAB: Accessing entries of symfun

MATLABmatricessymbolic

I am trying to solve a structural mechanics problem for which I have defined
clear allclose allclcsyms psi(x_1, x_2, x_3)syms E nuu_1 = diff(psi, x_1, 1);u_2 = diff(psi, x_2, 1);u_3 = diff(psi, x_3, 1);epsilon_1 = diff(u_1, x_1, 1);epsilon_2 = diff(u_2, x_2, 1);epsilon_3 = diff(u_3, x_3, 1);gamma_12 = diff(u_1, x_2, 1) + diff(u_2, x_1, 1);gamma_13 = diff(u_1, x_3, 1) + diff(u_3, x_1, 1);gamma_23 = diff(u_2, x_3, 1) + diff(u_3, x_2, 1);epsilon = [epsilon_1; epsilon_2; epsilon_3; gamma_23; gamma_13; gamma_12];C = E / ((1 + nu) * (1 - 2 * nu)) * [1 - nu nu nu 0 0 0; ...    nu 1 - nu nu 0 0 0; ...    nu nu 1 - nu 0 0 0; ...    0 0 0 (1 - 2 * nu) / 2 0 0; ...    0 0 0 0 (1 - 2 * nu) / 2 0; ...    0 0 0 0 0 (1 - 2 * nu) / 2];sigma = C * epsilon
Since the size of C is 6 x 6 and the size of epsilon is 6 x 1; the order of sigma should be 6 x 1. However when I use
size(sigma)
I get 1 x 1, which does not make sense to me. Also, I want to access individual entries of sigma. How can I do that?

clear allclose allclcsyms psi(x_1, x_2, x_3)syms E nuu_1 = diff(psi, x_1, 1);u_2 = diff(psi, x_2, 1);u_3 = diff(psi, x_3, 1);epsilon_1 = diff(u_1, x_1, 1);epsilon_2 = diff(u_2, x_2, 1);epsilon_3 = diff(u_3, x_3, 1);gamma_12 = diff(u_1, x_2, 1) + diff(u_2, x_1, 1);gamma_13 = diff(u_1, x_3, 1) + diff(u_3, x_1, 1);gamma_23 = diff(u_2, x_3, 1) + diff(u_3, x_2, 1);epsilon = [epsilon_1; epsilon_2; epsilon_3; gamma_23; gamma_13; gamma_12];C = E / ((1 + nu) * (1 - 2 * nu)) * [1 - nu nu nu 0 0 0; ...    nu 1 - nu nu 0 0 0; ...    nu nu 1 - nu 0 0 0; ...    0 0 0 (1 - 2 * nu) / 2 0 0; ...    0 0 0 0 (1 - 2 * nu) / 2 0; ...    0 0 0 0 0 (1 - 2 * nu) / 2];sigma = C * epsilon;sigma = formula(sigma) % -------- %