I need help in solving a matrix (Tensors)

clc
clear all
close all
E0 = 5; % Permivittity at infinite frequency
W_P = 13.4e15; % Plasma Frequency
Gamma = 0.7e14; % collison Frequency
c = 3e8; % Speed of light in vacuum
e0 = 8.85e-12; % Permivittity in free space
lambda=1350e-9:10e-9:1750e-9;
f=c./lambda;
w=2*pi*f;
e11 = E0-(W_P^2./(w.^2-(1i*Gamma.*w)));
e22=16.2;
e33=11.9;
h1= 8; %Silver
h2= 25; %Silica
h3=19; %Germanium
e_TM=(e11.*e22.*e33)./((e22.*e33.*h1)+(e11.*e33.*h2)+(e11.*e22.*h3))./(h1+h2+h3);
e_TE=((e11.*h1)+(e22.*h2)+(e33.*h3))./(h1+h2+h3);
figure
plot(lambda,real(e_TM),'b',lambda,imag(e_TM),'g')
xlabel('Wavelength')
ylabel('permivittity (TM Mode)')
legend('Real','Imag')
figure
plot(lambda,real(e_TE),'b',lambda,imag(e_TE),'g')
xlabel('Wavelength')
ylabel('permivittity (TE Mode)')
legend('Real','Imag')
Here, I need to caluculate
figure
plot(lambda,real(e_eff),'b',lambda,imag(e_eff),'g')
Unrecognized function or variable 'e_eff'.
legend('real','Im','Location','southeast');
xlabel('Wavelength (nm)');
ylabel('Effective Permittivity');

 Réponse acceptée

Morgan
Morgan le 7 Fév 2024
Modifié(e) : Morgan le 7 Fév 2024
If I'm understanding your question correctly, you're trying to calculatte an effective medium tensor of the form:
where
Usually , , and are fill fractions for each composite material and have values in the range of 0 to 1, but I could just be unfamiliar with the exact effective medium model you're using. I've also never encountered a material with only one dispersive (varies with frequency) tensor element. Usually each tensor element is dispersive.
Assuming this is the case, however, the code you're looking for is:
e_eff = zeros(3,3,length(w));
e_eff(1,1,:) = e0*e_TE(:);
e_eff(2,2,:) = e0*e_TE(:);
e_eff(3,3,:) = e0*e_TM(:);
This creates a permittivity tensor that follows the effective medium model at each frequency w you've provided.
Also, I noticed you wanted to plot the effective tensor with:
figure
plot(lambda,real(e_eff),'b',lambda,imag(e_eff),'g')
legend('real','Im','Location','southeast');
xlabel('Wavelength (nm)');
ylabel('Effective Permittivity');
MATLAB will error out saying "Data cannot have more than 2 dimensions" since you're attempting to plot 9 tensor elements per wavelength. If you could clarify what exactly you're trying to plot, I might be able to assist further.

4 commentaires

CHARUMATHI P R
CHARUMATHI P R le 7 Fév 2024
Thanks a lot, sir.
I like to plot lambda vs effective refractive.
If I have data of e_22(w) and e_33(w). How I have to proceed with the tensor, sir?
Morgan
Morgan le 7 Fév 2024
Modifié(e) : Morgan le 7 Fév 2024
Your code would then be:
% INITIALIZE MATLAB
clear variables
close all
clc
% CONSTANTS
c = 3e8; % Speed of light in vacuum
e0 = 8.85e-12; % Permivittity in free space
% DRUDE PARAMETERS
E0 = 5; % Permivittity at infinite frequency
W_P = 13.4e15; % Plasma Frequency
Gamma = 0.7e14; % collison Frequency
% EFFECTIVE MEDIUM PARAMETERS
h1 = 8; % Silver
h2 = 25; % Silica
h3 = 19; % Germanium
% WAVELENGTH
lambda = (1350 : 10 : 1750)*1e-9;
% CALCULATE ANGULAR FREQUENCY
f = c./lambda;
w = 2*pi*f;
% PERMITTIVITIES AS FCN OF w
e11 = E0-(W_P^2./(w.^2-(1i*Gamma.*w)));
e22 = 16.2; % Replace with e22(w) data
e33 = 11.9; % Replace with e33(w) data
% CALCULATE EFFECTIVE MEDIUM PERMITTIVITIES
e_TE = (h1*e11 + h2*e22 + h3*e33) ...
/ (h1+h2+h3);
e_TM = (h1+h2+h3)*(e11.*e22.*e33) ...
./ (h1*e22.*e33 + h2*e11.*e33 + h3*e11.*e22);
% CALCULATE EFFECTIVE PERMITTIVITY TENSOR
e_eff = zeros(3,3,length(w));
e_eff(1,1,:) = e0*e_TE(:);
e_eff(2,2,:) = e0*e_TE(:);
e_eff(3,3,:) = e0*e_TM(:);
% CALCULATE EFFECTIVE REFRACTIVE INDEX
n_TE = real(sqrt(e_TE)); % <-- Assumes permeability is 1
n_TM = real(sqrt(e_TM)); % <-- Assumes permeability is 1
figure
plot(lambda,n_TE,'b',lambda,n_TM,'g')
xlabel('Wavelength')
ylabel('Refractive Index, $n$','Interpreter','latex');
legend('$n_\mathrm{TE}$','$n_\mathrm{TM}$',...
'Interpreter','latex','Location','best','box','off')
Unless you're fitting an effective medium model to metamaterial like properties you shouldn't get refractive index values less than one.
Let me know if you need any more help!
CHARUMATHI P R
CHARUMATHI P R le 7 Fév 2024
Sir, How to plot effective permittivity vs wavelength
If you're trying to plot the effective permittivity tensor, this does not make sense. I recommend plot each unique element of the tensor ( and ) separately like the code you had previously:
% PLOT EFFECTIVE PERMITTIVITY (TE MODE)
figure
plot(lambda,real(e_TE),'b',lambda,imag(e_TE),'g')
xlabel('Wavelength')
ylabel('permivittity (TE Mode)')
legend('Real','Imag')
% PLOT EFFECTIVE PERMITTIVITY (TM MODE)
figure
plot(lambda,real(e_TM),'b',lambda,imag(e_TM),'g')
xlabel('Wavelength')
ylabel('permivittity (TM Mode)')
legend('Real','Imag')
By chance, if you're referring to plotting an Index Ellipsoid this will be slightly more complicated and doesn't show refractive index as a function of wavelength unless you animate the plot.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by