Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
change from frequency to time domain
    조회 수: 6 (최근 30일)
  
       이전 댓글 표시
    
    %%%hello every one so here is my code in solving the NLSE(Non Linear Schrödinger Equation) using Split Step Fourier Method where I introduce a Gaussian pulse in time domain and transform it to frequency domain and use the method to observe what happens to the pulse after it enters the fiber. My next assignment is similar to this one but i need to start with the frequency domain and change it to time domain and also solve it . I know the way where i introduce a frequency Gaussian pulse but i am having a problem in the syntax any help. To know if my work is done properly the the codes should give me same results So is my code Any thoughts???%%%
    L=1;%%length fiber
    %---set simulation parameters
    nt = 2^12; Tmax = 32; % FFT points and window size
    step_num = 1000; % No. of z steps to
    h = L/step_num; % step size in z
    dtau = (2*Tmax)/nt; % step size in tau
    %---tau and omega arrays
    tau = (-nt/2:nt/2-1)*dtau; % temporal grid
    w = (pi/Tmax)*[(0:nt/2-1) (-nt/2:-1)]; % frequency grid
    beta2=0.25;
    beta3=0;
    D=(1i.*beta2.*0.5.*w.^2)-((1./6).*1i.*beta3.*w.^3); % dispersion operator
    %%%%input pulse
    A0=8;
    A1=4;
    A=1*exp(-tau.^2.*0.5);
    A2=1;
    M=fftshift(fft(A));
    %---Plot input pulse shape and spectrum
    tempo =(M).*(nt*dtau)/sqrt(2*pi); % spectrum
    figure; 
    subplot(2,1,1);
    plot(tau, abs(A).^2,'--k'); hold on;
    axis([-10 10 0 inf]);
    xlabel('Normalized Time');
    ylabel('Normalized Power');
    title('Input and Output Pulse Shape and Spectrum');
    subplot(2,1,2);
    plot(fftshift(w)/(2*pi),abs(tempo).^2, '--k'); 
    hold on;
    axis([-10 10 0 inf]);
    xlabel('Normalized Frequency');
    ylabel('Spectral Power');
    %%%%calculating pulse multiplied by the dispersion factor%%
    gamma=1;% gamma=(2*pi*n2)/lamda*Aeff also Beta2=-lamdazero*D/(2*pi*c) also beta3=(lamdazero/2*pi*c)^2;{(2*lamdazero*D)+(lamdazero^2 * derivative of D)}
    %temp3=temp2.*exp(h.*0);
        temp2=fft(A);
       temp3=temp2.*exp(D.*h.*0.5);
       temp4=ifft(temp3);
    %%%%%%%%%
    for m=1:step_num
        Nonlinear=exp(1i.*h*gamma.*A.^2).*temp4;
        temp5=fft(Nonlinear);
    temp6=temp5.*exp(D.*h./2);
    temp4=ifft(temp6);
    end
    temp8=fft(temp4);
    temp9=temp8.*exp(-1.*(h./2).*D);
    temp10=ifft(temp9);
    % final pulse
    tempo=fftshift(fft(temp10)).*(nt*dtau)/sqrt(2*pi); %Final spectrum
    %----Plot output pulse shape and spectrum
    figure; 
    subplot(2,1,1);
    plot(tau, abs(temp10).^2,'-k'); hold on;
    axis([-20 20 0 inf]);
    xlabel('Normalized Time');
    ylabel('Normalized Power');
    title('Input and Output Pulse Shape and Spectrum');
    subplot(2,1,2);
    plot(fftshift(w)/(2*pi), abs(tempo).^2, '-k'); 
    hold on;
    axis([-10 10 0 inf]);
    xlabel('Normalized Frequency');
    ylabel('Spectral Power');
댓글 수: 0
답변 (0개)
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
