Matlab - create a table from a vector in the first row and another in the first column
Mostra commenti meno recenti
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<=fp
delta_2=0.09; % if f>fp
Tp=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
end
end
E
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.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!