Arrays have incompatible sizes for this operation.
Afficher commentaires plus anciens
clear;
% Frequency range from 1 MHz to 100 GHz
v = logspace(6, 11, 1000); % Using logspace for a smoother frequency range
w = 2*pi*v ;
T = 15 ; % temperature of seawater in degree celcius
e = 8.854*(10^-12); % permittivity of free space
% Salinity range from 20 to 40 PSU (Practical Salinity Units)
S = linspace(20,40,100);
mu = 4*pi*10^-7; % permeability of sea water
d = 100; % distance in meters
a0 = 5.72;
a1 = 2.24*(10^-2);
a2 = -7.12*(10^-4);
a3 = 5.05 ;
a4 = -7.03*(10^-2);
a5 = 6.006*(10^-4);
a6 = 3.6;
a7 = 2.9*(10^-2);
a8 = 1.4*(10^-1);
a9 = 1.5*(10^-3);
a10 = 2.4*(10^-4);
b0 = -3.56*(10^-3);
b1 = 4.75*(10^-6);
b2 = 1.16*(10^-5);
b3 = 2.4*(10^-3);
b4 = -3.14*(10^-5);
b5 = 2.52*(10^-7);
b6 = -6.3*(10^-3);
b7 = 1.76*(10^-4);
b8 = -9.22*(10^-5);
b9 = -1.99*(10^-2);
b10 = 1.812*(10^-4);
b11 = -2.05*(10^-3);
b12 = 1.58*(10^-4);
c1 = (3.709*10^4-8.22*10*T)/(4.22*10^2+T);
c2 = a0+a1*T+a2*(T^2);
e_1 = c2*(exp(b6.*S+b7*(S.^2)+b8*T.*S));
e_s = exp(b0.*S+b1*S.^2+b2.*S*T);
e_inf = (a6+a7*T)*(1+S*(b11+b12*T)); % dielectric constant at high frequencies
e_0 = c1*e_s; % static dielectric constant at low frequencies
v_01 = (45+T)/(a3+a4*T+a5*(T^2));
v1 = v_01.*(1+S*(b3+b4*T+b5*(T^2)));
v_02 = (45+T)/(a8+a9*T+a10*(T^2));
v2 = v_02*(1+S*(b9+b10*T));
R1 = (37.5109-5.45216*S+1.4409*(10^(-2))*(S.^2))/( 1004.75+182.283*S+(S.^2));
s = T-15;
A1 = (6.9431+3.2841*s-9.9486*(10^(-2))*(s^2))/( 84.850+69.024*s+(s^2)) ;
A2 = 49.843+0.2276*S+0.198*(10^(-2))*(S.^2)+T;
R2 = 1+(A1./A2);
temp_2 = R1.*R2;
sigma_0 = S*( 2.903602+8.607*(10^(-2))*T+4.738817*(10^(-4))*(T^2)-2.991*(10^(-6))*(T^3)+4.3047*(10^(-9))*(T^4));
sigma = sigma_0.*temp_2;
temp = (e_0 - e_1)./(1+1i*v./v1);
temp_0 = (e_1 - e_inf)./(1+1i*v./v2);
temp_1 = sigma./(w*e);
e_sw = e_inf + temp +temp_0 - 1i*temp_1;
epsilon = e_sw.*e ;
temp_inner = (w.*epsilon).^2;
temp_inner1 = sqrt(1 + (sigma./temp_inner)) - 1; % Inner square root
alpha = w.*sqrt((mu*epsilon./2).*temp_inner1); % Attenuation constant
z = 2*alpha*d;
A = abs(10*log10(exp(-z))); % Attenuation loss in dB
figure;
plot(v,A);
% Add labels and a colorbar
xlabel('Frequency (Hz)');
ylabel('Attenuation (dB)');
title('Frequency vs. Salinity vs. Permittivity of Seawater');
colorbar;
grid on;
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Analysis and Verification dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
