我无法匹配矩阵的大小。我试图模拟在具有电导率segma的介质中移动的Em波。问题是当我尝试绘制E和H字段时,它会给我一个错误(矩阵大小错过匹配)。我试图改变值,但仍然没有输出。如果有人帮我解决这个问题。提前致谢
segma=5
f=1000
m=2
w=2*pi*f ; % Omega
Eo= 8.854187817*10^12; %vaccum permitivity of air
y=(1+1i)*sqrt(pi*f*Eo*m*segma); % definning gamma
a=real(y)% definning alpha
b=imag(y);% defining beta
s=1/a;%skin depth
n=(1+1i)/segma*s;%characteristic impedance
vp=w*s; % phase velocity
lambda= 2*pi*s; % wavelength
t=0:1:100; % Time for analysis
z=0:1:100; % Range of Space under analysis
Ex=exp(-z*a)*cos(w*t-z*a); % assuming one component in the x-direction propagating in the +z direction . Also we have assumed E+=1
Hy=Ex/n; % Assuming one component in the y-direction
subplot(2,1,1)
plot(z,Ex,'g');
xlabel('z(metres)');
ylabel('Ex(E)');
title('Plane wave propagation in free space medium');
subplot(2,1,2)
plot(z,Hy,'r');
xlabel('z(metres)');
ylabel('Hy(H)');
答案 0 :(得分:0)
您的代码:
Ex=exp(-z*a)*cos(w*t-z*a);
exp(-z*a)
为您提供1乘101的矩阵,cos(w*t-z*a)
给出另一个1乘101的矩阵。如果需要element-wise multiplication,则需要在.
之前添加*
。
所以修复是:
Ex=exp(-z*a).*cos(w*t-z*a);