MATLAB: How to build a matrix that element are changing with time

matrix with changing elements

I am trying to find the matrix ABD where as you can see in the code below that all values that I used are from another functions and they change with 'm',I ran the code to find the value of ABD for each 'm', but I only get the value at m=101;I tried ABD(m) but it is considered as index of element ,I wonder if there is a way to find ABD for each value of 'm' where for example if I want ABD(50).
function [ ABD ] = ABD_matrix(t,N,H) [EEc, EEm, ~ ,~ ] = properties_functionT(t); [ ~,~,nu,~,~,~,~] = Properties_functionTZ(N,t); H=0.01; for m=1:101 A11(m)=(EEc(m)-EEm(m))/(1-nu^2); B11(m)=(H*EEc(m)-A11(m))/(1-nu^2); D11(m)=((H^2)*EEc(m)-B11(m))/(1-nu^2); ABD=[A11(m) B11(m);B11(m) D11(m)]; end end

Best Answer

ABD=zeros(2,2,101); %pre-allocate
for m=1:101
A11(m)=(EEc(m)-EEm(m))/(1-nu^2);
B11(m)=(H*EEc(m)-A11(m))/(1-nu^2);
D11(m)=((H^2)*EEc(m)-B11(m))/(1-nu^2);
ABD(:,:,m)=[A11(m) B11(m);B11(m) D11(m)];
end
Related Question