Plotting 1 set of data with two different axis - 1 reverse oriented
1 回表示 (過去 30 日間)
古いコメントを表示
Greetings, I am looking for a way to plot a set of data showcasing dispersion of the surface plasmon at the gold-air interface with two different x and y axis. Basically what I am trying to achieve is to plot angular frequency of the excitation wave, the wavevector, the wavelength of the incident EM field and the wavelength of the surface plasmon into one graph without having to plot a second set of data (in this case the wavevector vs wavelength). here is the code I use. Many thanks for the response in advance.
clear;
clc;
h_trans= 6.582119569e-16;
lambda0 = 450e-9;
c= 299792458;
omega_p_drude = 8.95./h_trans;
omega_0 = (2*pi.*c)./lambda0;
gama_drude = 0.0658./h_trans;
omega_p_interband = 2.96./h_trans;
gama_interband = 0.59./h_trans;
omega = linspace (1e+15,7e+15,1000)
k_0 = omega./(2*pi*c);
lambda = (2*pi*c./omega).*1e+9;
epsilon_d = 1;
epsilon_drude = 1- ((omega_p_drude^2)./(omega.^2+1i*gama_drude.*omega))% Drude model
epsilon_interband = 5+((omega_p_interband^2)./((omega_0^2-omega.^2)-1i*gama_interband.*omega)) %interband transitions
epsilon_r = epsilon_drude + epsilon_interband;
k_z = (((epsilon_r.*epsilon_d)./(epsilon_r+epsilon_d)).^(1/2)).*(omega./c)
k_z2 = (((epsilon_r.*epsilon_d)./(epsilon_r+epsilon_d)).^(1/2)).*(omega./c)
lambda_sp= ((((epsilon_d+epsilon_r)./(epsilon_d.*epsilon_r)).^(-1/2))).*lambda;
lambda_light_line = lambda.*epsilon_d;
figure (1)
hold on;
grid on;
yyaxis left;
plot (lambda,real(epsilon_r),'LineWidth',2);
xlabel ('Wavelength [m]');
ylabel ([char(949) '_{Real}' '[F/m]']);
%line([1250 1250],[-180 -75],'linewidth',2);
yyaxis right
plot (lambda,imag(epsilon_r),'r','linewidth',2);
ylabel ([char(949) '_{Im}' '[F/m]'])
hold on;
grid on;
figure (2)
hold on;
yyaxis left;
plot ((k_z),omega,'LineWidth',2);
plot (k_0,(omega),'r','LineWidth',2);
grid on;
ylabel ('\omega [Hz]')
xlabel ('k_{x} [m^{-1}]');
legend ('Au/air SPP','light line');
yyaxis right;
plot (k_z,lambda)
set(gca, 'YDir','reverse')
0 件のコメント
回答 (1 件)
Brahmadev
2024 年 5 月 14 日
As per my understanding, you would like to merge both the figures 1 and 2 and plot both the components of Epsilon on the same axes. You can create 2 axes and set the x-axis location of one of them on top and y-axis on right. See example in the documentation link below:
After creating this alternate axes, you can assign this to Epsilon. Although this would mean that the scales of both real and imaginary compoenent are identical.
Also, since wavenumber and wavelength are inverseley proportional, we can also consider converting the Epsilon data as a function of wavevector and plot it in figure 2 with Kx [m^-1] as the X-axis.
Hope this helps!
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!