ERROR : Unrecognized function or variable , Index exceeds the number of array elements
Mostrar comentarios más antiguos
Graphs of parallel and vertical polarization of microwaves are being implemented as matlabs.
However, the error mentioned in the title occurred.
Please tell me how to solve this error.
er1 = 2.55;
er2 = 1;
eta_1 = 377;
eta_2 = 377/sqrt(er1);
sin(theta_b) = 1/sqrt(1+er1/er2);
cos(theta_t) = sqrt(1-er1*sin(theta_b)^2/er2);
for theta_i = [1:90];
parallel_pol = (eta_2*cos(theta_t)-eta_1*cos(theta_i))/(eta_2*cos(theta_t)+eta_1*cos(theta_i));
end
plot(theta_i,abs(parallel_pol),"-","r","LineWidth",2)
Respuesta aceptada
Más respuestas (2)
David Hill
el 16 de Mzo. de 2022
er1 = 2.55;
er2 = 1;
eta_1 = 377;
eta_2 = 377/sqrt(er1);
sin_theta_b = 1/sqrt(1+er1/er2);%just a scalar sin(theta_b) makes no sense
cos_theta_t = sqrt(1-er1*sin_theta_b^2/er2);%just scalar cos(theta_t) makes no sense
theta_i = 1:90;%no need for a loop (I assume this is in degrees)
parallel_pol = (eta_2*cos_theta_t-eta_1*cosd(theta_i))./(eta_2*cos_theta_t+eta_1*cosd(theta_i));%I assume you want cosd
plot(theta_i,abs(parallel_pol))
1 comentario
건희 이
el 16 de Mzo. de 2022
Enrico Gambini
el 16 de Mzo. de 2022
Hi, try this.
er1 = 2.55;
er2 = 1;
eta_1 = 377;
eta_2 = 377/sqrt(er1);
sin_theta_b = 1/sqrt(1+er1/er2);
cos_theta_t = sqrt(1-er1*sin_theta_b^2/er2);
for i = [1:90];
parallel_pol(i) = (eta_2*cos_theta_t-eta_1*cos(i))/(eta_2*cos_theta_t+eta_1*cos(i));
end
plot([1:90],abs(parallel_pol),"r-","LineWidth",2);
1 comentario
건희 이
el 16 de Mzo. de 2022
Categorías
Más información sobre Lengths and Angles en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
