getting error for my program as " Error using * Inner matrix dimensions must agree." on line 42 . can someone help me resolve this issue?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
asim asrar
am 13 Nov. 2018
Kommentiert: asim asrar
am 13 Nov. 2018
clc;
clear all; close all; clf;
Pi=30*10^13; %input('Enter the value of input power in mW ')
t=101.95*10^-15; %input('Enter the value of input pulse width in seconds ')
tau=-300*10^-15:0.01*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=1/t;
% dt=10^-4.9/t;
c=3*1e8;
z=30*10^-3;
deff=2.064*10^-12;
pi=3.1415926535;
esn=8.854*10^-12
I0=30*10^13;
E0=sqrt(Pi); %for ii=0.1:0.1:(s/10) %1*10^-7:1*10^-7:s %different fiber lengths
E1=E0*exp(-(tau/t).^2); % generation of an gaussian input pulse
subplot(2,1,1);
plot(tau,abs(E1).^2); % graph of input pulse
title('Input Pulse'); xlabel('Time in ps'); ylabel('intensity');
grid on;
hold on;
N=max(size(E1));
dw=((1/N)/dt)*2*pi
j=1;
k=1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for Dk=0:500:60000;
t1=[0.000312258194071092];
t2=[0.000312258194068605]
Lnll=(Dk)./(t1*t2*abs(I0^2))*10
Lnl(j)=Lnll;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
p1=800*10^-9;
p2=p1/2;
n1=1.6551;
n2=1.6749;
n33=(4*pi*z*deff^2)/(c*esn*L*n1^2*n2*Dk.*z)
n3(k)=n33;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
w3=dw*(-N/2:1:N/2-1);
n3=9.1514*10^-20;
P = (-1i*conj(E1).*E1.^2.*w3.*deff)/(Dk.*n3.*c)+ 1i*2*pi*(n3.*I0)*(Lnl./L)*((abs(E1)).^2).*E1 +...
+ 1i*4*pi*(n3.*I0)*(Lnl./L).*((-w3.*deff.*E1.^2*exp(-1i*Dk.*z))/(Dk.*n3.*c)).^2.*E1;
pause(0.1)
subplot(2,1,2);
plot(tau,abs(P).^2);
caption1 = sprintf('Output pulse with Delta K = %.3f', Dk);
title(caption1, 'FontSize',10);
xlabel('Time in ps'); ylabel('intensity');
j=j+1;
k=k+1;
end
hold on;
grid on;
2 Kommentare
Akzeptierte Antwort
KSSV
am 13 Nov. 2018
Pi=30*10^13; %input('Enter the value of input power in mW ')
t=101.95*10^-15; %input('Enter the value of input pulse width in seconds ')
tau=-300*10^-15:0.01*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=1/t;
% dt=10^-4.9/t;
c=3*1e8;
z=30*10^-3;
deff=2.064*10^-12;
pi=3.1415926535;
esn=8.854*10^-12
I0=30*10^13;
E0=sqrt(Pi); %for ii=0.1:0.1:(s/10) %1*10^-7:1*10^-7:s %different fiber lengths
E1=E0*exp(-(tau/t).^2); % generation of an gaussian input pulse
subplot(2,1,1);
plot(tau,abs(E1).^2); % graph of input pulse
title('Input Pulse'); xlabel('Time in ps'); ylabel('intensity');
grid on;
hold on;
N=max(size(E1));
dw=((1/N)/dt)*2*pi
j=1;
k=1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for Dk=0:500:60000
Dk
t1=[0.000312258194071092];
t2=[0.000312258194068605]
Lnll=(Dk)./(t1*t2*abs(I0^2))*10
Lnl(j)=Lnll;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
p1=800*10^-9;
p2=p1/2;
n1=1.6551;
n2=1.6749;
n33=(4*pi*z*deff^2)/(c*esn*L*n1^2*n2*Dk.*z) ;
n3=n33;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
w3=dw*(-N/2:1:N/2-1);
n3=9.1514*10^-20;
P = (-1i*conj(E1).*E1.^2.*w3.*deff)./(Dk.*n3.*c)+ 1i*2*pi*(n3.*I0).*(Lnl(j)./L).*((abs(E1)).^2).*E1 +...
+ 1i*4*pi*(n3.*I0).*(Lnl(j)./L).*((-w3.*deff.*E1.^2.*exp(-1i*Dk.*z))./(Dk.*n3.*c)).^2.*E1;
pause(0.1)
subplot(2,1,2);
plot(tau,abs(P).^2);
caption1 = sprintf('Output pulse with Delta K = %.3f', Dk);
title(caption1, 'FontSize',10);
xlabel('Time in ps'); ylabel('intensity');
j=j+1;
k=k+1;
end
hold on;
grid on;
0 Kommentare
Weitere Antworten (2)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!