Inner matrix dimensions must agree. my code is giving this error , can someone help me fix this

1 visualización (últimos 30 días)
clc;
Pi=3.98; %input('Enter the value of input power in mW ')
t=120*10^-15 %input('Enter the value of input pulse width in seconds ')
tau=-300*10^-15:0.1*10^-15:300*10^-15; %input('Enter time period with upper(U), lower(L) and interval between upper and lower interval(I) in this format L:I:U')
L=800*10^-9
dt=1e-15/t
fs=1/dt;
c=3*1e8;
pi=3.1415926535;
Ao=sqrt(Pi) % amplitude of an input gaussian pulse
h=2000 % small step as defined by split step algorithm
%for ii=0.1:0.1:(s/10) %1*10^-7:1*10^-7:s %different fiber lengths
E1=Ao*exp(-(tau/t).^2); % generation of an gaussian input pulse
figure(1)
plot(abs(E1)); % graph of input pulse
title('Input Pulse'); xlabel('Time in ps'); ylabel('Amplitude');
grid on;
hold off;
N=max(size(E1));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Dk=20.94;
z=1;
w1=fs*[-N/2:N/2-1];
deff=2.0657e-12;
Lc=2*pi/Dk;
Lnl=200*Lc;
n2=5*10^-16;
I0=10^-9;
P=(-1i*conj(E1).*E1.^2*w1.*deff)/(c*n2*Dk)+ 1i*2*pi*(n2*I0)*(Lnl/L)*((abs(E1)).^2).*E1 +...
+ 1i*4*pi*(n2*I0)*(Lnl/L)*((-w1.*deff*E1.^2*exp(-1i*Dk*z))/(c*n2*Dk)).^2*E1;

Respuesta aceptada

Torsten
Torsten el 9 de Oct. de 2018
Editada: Torsten el 9 de Oct. de 2018
Use
P = (-1i*conj(E1).*E1.^2.*w1*deff)/(c*n2*Dk)+ 1i*2*pi*(n2*I0)*(Lnl/L)*((abs(E1)).^2).*E1 +...
+ 1i*4*pi*(n2*I0)*(Lnl/L).*((-w1*deff.*E1.^2*exp(-1i*Dk*z))/(c*n2*Dk)).^2.*E1;

Más respuestas (0)

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by