clear all; clc; close allrho_sea=1027; rho_air=1225; g=9.8; k=0.4; alpha=0.008;gamma=3.3;delta_1=0.07; % if f<=fp
delta_2=0.09; % if f>fp
Tp=[2 10 16]; fp=1./Tp; T=2:1:16;f=1./T;u= [1.192 1.194 1.120]; z=[0.0021 0.0029 0.0033]; sigma= 2*pi*f; k_nw=sigma.^2./g; i_freq=1:69;f1=0.03093; c=1.1;for i = 1:length(i_freq)fi=f1.*c.^(i_freq-1);end i_teta=1:36;teta_i=10.*i_teta;%%% T=2s
%mi
mi = zeros(numel(teta_i),numel(sigma));for i=1:length(sigma) for j=1:length(teta_i) mi(j,i)=(((g*z(1,1).*(k_nw(i).^2))./sigma(i).^2).*exp((k*sigma(i))./(k_nw(i).*u(1,1)).*cos(teta_i(j)))); end end% mp
mp=(1.2./k).*mi.*log(mi).*log(mi).*log(mi).*log(mi);%beta
beta= zeros(numel(teta_i),numel(T));Cf=(g.*T)./(2.*pi);for i=1:length(T) for j=1:length(teta_i) beta(j,i)=(rho_air./rho_sea).*mp.*((u(1,1))./(Cf)).^2.*(1+cos(teta_i(j).*2)./2); end end
I'm having trouble (in the third row from the bottom up):
beta(j,i)=(rho_air./rho_sea).*mp.*((u(1,1))./(Cf)).^2.*(1+cos(teta_i(j).*2)./2);
The error message appears: "Assignment has more non-singleton rhs dimensions than non-singleton subscripts"
The code is above and below has the formulas (I started from the bottom up).
Thanks for the help
Best Answer