Azzera filtri
Azzera filtri

how to solve my problem that i write

1 visualizzazione (ultimi 30 giorni)
asma
asma il 22 Apr 2024
Spostato: Dyuman Joshi il 23 Apr 2024
I write this code and i wanne output that show me like a sinc function like picture that i attached. the other point is about my l value that i defined it, i wanne some random number between 11e-6 till 13e-6, is it true like this that i define?
tnx.
clc;
clear;
close all;
capital_lambda = 20e-6;
% define sellmier equation to obtain refractive index
lambda_sh=0.775e-6; % SH wavelength
nlithium_sh = 2.1784;
lambda_ff=1.55e-6; % FF wavelength
nlithium_ff = 2.1376;
% parameters
capital_lambda = 20e-6;
k_sh=(2*pi/lambda_sh)*nlithium_sh;
k_ff=(2*pi/lambda_ff)*nlithium_ff;
Delta_kk = k_sh-2*k_ff;
%km=2*pi/capital_lambda;
L = 1; % Length;
sigma_l = 2; % sigma_l = l*sigma_avg
N=L/(capital_lambda/2); % number of domains
l=unifrnd(11e-6,13e-6,[1,1000]); %
for i=l
f=exp(-(pi.^2) .* (sigma_l.^2)/2.*(l.^2));
Delta_k=(k_sh-2*k_ff)-pi./l;
E3= f .* (sinc((Delta_k .* L)/2)).^2 + ((1-f)/N);
end
plot(E3)
%plot(abs(fftshift(fft2(E3))))
xlabel('(Delta_k * L)/pi');
ylabel('SHG Effiency');

Risposte (1)

Hassaan
Hassaan il 22 Apr 2024
Modificato: Hassaan il 22 Apr 2024
clc;
clear;
close all;
% Constants and parameters
lambda_sh = 0.775e-6; % SH wavelength
nlithium_sh = 2.1784;
lambda_ff = 1.55e-6; % FF wavelength
nlithium_ff = 2.1376;
L = 1; % Length in some units, assuming meters
% Wave numbers
k_sh = (2 * pi / lambda_sh) * nlithium_sh;
k_ff = (2 * pi / lambda_ff) * nlithium_ff;
% Define the range of Delta_k*L/pi to evaluate the sinc-squared function
delta_kL_over_pi = linspace(-20, 120, 10000); % For a smooth curve
Delta_k = delta_kL_over_pi * pi / L;
% Calculate the sinc-squared function
E3 = sinc(Delta_k / (2*pi)).^2;
% Plotting
figure;
semilogy(delta_kL_over_pi, E3, 'LineWidth', 2);
xlabel('\Delta k L/\pi');
ylabel('Relative Efficiency |g|^2');
title('Second Harmonic Generation Efficiency');
grid on; % Adding grid for better readability
axis tight; % Remove extra white space in the plot
-----------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
It's important to note that the advice and code are based on limited information and meant for educational purposes. Users should verify and adapt the code to their specific needs, ensuring compatibility and adherence to ethical standards.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems | Firmware Developement | Simulations
  • Electrical and Electronics Engineering
Feel free to contact me.
  1 Commento
asma
asma il 23 Apr 2024
Spostato: Dyuman Joshi il 23 Apr 2024
why you omit f(sigma_l)? and another thing is delta_kk is a parameter that depends on k2-2*k1 , you omit this too and define delta_k_over_pi
can you explain it more
tnx alot

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by