Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 其它 > 资料存档
资料存档 资料存档
回复
 
主题工具 显示模式
旧 2019-11-27, 13:24   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,006
声望力: 66
poster 正向着好的方向发展
默认 Matlab code Unable to perform assignment because the left and right sides have a different number of

I ma try to plot some signal using Matlab I wrote the code
But when I try to run it it through an error **Unable to perform assignment because the left and right sides have a different number of elements **
I can't figure what is the problem. I need to understand how can I solve it
Can some one help me get over this problem



lambda= 30*10.^-6;%Wavelength 5um
L=10*10.^-9;
c=3*10.^8;
q= 1.6*10.^-19;
kb= 1.38*10.^-23;
T= 298;
Vf= 10.^6;
hev= 6.582*10.^-16;
kbev= 8.6*10.^-5;
tau= 6*10.^-12;
h= 1.055*10.^-34;
d= 80*10.^-9;
n=1;
eps=(n)^2;
fc = c/lambda; % Actual Frequency of light [THz]
fsamp=fc*10; %sampling frequency
fs=1/fsamp; %Unit Time in [fs]
Ls=1000; %Length of signal
s=5e-13;%% Pulse duration, s=8e-15;
ts=(0:Ls-1)*fs; %time base
t0 = max(ts)/2; % Used to centering the pulse
Egauss=(exp(-((ts-t0)-50e-15).^2/(2*s)^2)).*exp(-1i*2*pi*fc*(ts-t0));
figure(1)
plot(ts,real(Egauss),'b');
title('Gaussian Pulse in Time Domain');
xlabel('Time(s)');
ylabel('Amplitude');
ylim([-1 1])

NFFT = 2^nextpow2(Ls);
X = fft(Egauss,NFFT)/Ls;
Pxx=X.*conj(X)/(NFFT*NFFT); %computing power with proper scaling
freq = fsamp*linspace(0,1,NFFT); % (full range) Frequency Vector
figure(2)
plot(freq, abs(X))
title('FFT of the Gaussian Pulse');
xlabel('Frequency (Hz)')
ylabel('Magnitude |X(f)|');
xlim([8.8e13 9.2e13
ii=0;
for NN = 8.8:0.01:9.2
ii = ii+1;

NNN=NN*10^13;

w0=2*pi*(fc+NNN);

lamda0=c/fc;

ko=2*pi/lamda0;

n0= 10^15;

mu= hev*Vf*(pi*n0).^.5;

sig= 1i*q.^2*kb*T*(mu/(kbev*T)+2*log(exp(-mu/(kbev*T))+1))./(pi*h.^2*(w0+1i/tau));
sigma=sig.';
wantedvalue=sig;

dispersion=d^-1*acos((cos(d*(eps)^.5*w0/c)-1i*Z0*.5*(eps)^-.5*sin(d*(eps)^.5*w0/c).*sigma));
dis(ii)=dispersion;

Beta(ii)=real(dispersion);
Alfa(ii)=abs(imag(dispersion));
%X1=(abs(X)).';

Adot=X(ii).*exp(-1i*Beta.*L).*exp(-Alfa.*L);

AAA(ii)=Adot;
end
figure(3)
plot(freq, abs(AAA))```




More answer...
poster 当前离线   回复时引用此帖
回复


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛禁用 表情符号
论坛启用 [IMG] 代码
论坛启用 HTML 代码



所有时间均为北京时间。现在的时间是 21:14


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.