# MATLAB: Matlab – create a table from a vector in the first row and another in the first column

for loopMATLABmatrixtablevector

Hello, I am trying to make a table inside Matlab, but it is not coming out with the correct results.
My routine:
``alpha=0.008;gamma=3.3;g=9.80665; delta_1=0.07; % if f<=fpdelta_2=0.09; % if f>fpTp=2:16;   fp=1./Tp;  T=2:16;    f=1./T;     nrows = 14;  ncols = 14;E = ones(nrows,ncols); for fp = 1:ncols          for f = 1:nrows           if f<=fp            E(f,fp) = (alpha*(g^2)*((2*pi)^(-4))*(f^(-5)))*exp((-5/4)*((f/fp)^(-4)))*gamma*exp((-1/2)*((f-fp)/(delta_1*fp))^2);        elseif f>fp            E(f,fp) = (alpha*(g^2)*((2*pi)^(-4))*(f^(-5)))*exp((-5/4)*((f/fp)^(-4)))*gamma*exp((-1/2)*((f-fp)/(delta_2*fp))^2);        else            E(f,fp) = 0;        end    endendE``
Attached is a figure that is reality (as it turned out) and another as expectation (as it was meant to be).
I thank you for your help.

``clcclear all%%%%%%%%%%alpha=0.008;gamma=3.3;g=9.80665; delta_1=0.07; % if f<=fpdelta_2=0.09; % if f>fpTp=2:16;   % fp=1./Tp;  fp_vector=1./Tp;  % T=2:16;    % f=1./T;    f_vector=1./T;   nrows = 14;  ncols = 14;E = ones(nrows,ncols);% ?? f and fp cannot be at the same time used as vector of decimal scalars and index in a for loop% see correction below % for fp = 1:ncols      % fp loopfor cj = 1:ncols      % fp loop%     for f = 1:nrows   % f loop    for ci = 1:nrows   % f loop                % extract f and fp  value        f = f_vector(ci);        fp = fp_vector(cj);                if f<=fp            E(ci,cj) = (alpha*(g^2)*((2*pi)^(-4))*(f^(-5)))*exp((-5/4)*((f/fp)^(-4)))*gamma*exp((-1/2)*((f-fp)/(delta_1*fp))^2);        elseif f>fp            E(ci,cj) = (alpha*(g^2)*((2*pi)^(-4))*(f^(-5)))*exp((-5/4)*((f/fp)^(-4)))*gamma*exp((-1/2)*((f-fp)/(delta_2*fp))^2);        else            E(ci,cj) = 0            % this condition is never reached as all cases are already covered with the two conditions above            % so what condition is supposed to give E = 0 ?         end    endendE``