필터 지우기
필터 지우기

How to get cross product?

조회 수: 2 (최근 30일)
MOHD
MOHD 2012년 10월 4일
Hi, I have problem in follolowing code,can any one help me to get cross product of E and B
clear all;
clc;
close all;
dim=64;
[kx,ky]=meshgrid(-1:2/(dim-1):1);
circ=sqrt(kx.^2+ky.^2)<1;
kx=kx/2;
ky=ky/2;
alp=asin(1);
k0=1/sin(alp);
k=256;
kz=sqrt(k0^2-(kx.^2+ky.^2));
Gx=sqrt(k0./kz).*((k0*ky.^2+kz.*kx.^2)./(k0*(kx.^2+ky.^2)));
Gy=sqrt(k0./kz).*((kz-k0).*kx.*ky)./(k0*(kx.^2+ky.^2));
Gz=sqrt(k0./kz).*(kx./k0);
l1=100;
z=-l1:1:l1;
c = numel(z);
mz=200/64;
n = size(kx);
Ex = zeros([k k c]);
Ey = zeros([k k c]);
Ez = zeros([k k c]);
q1 = exp(1i*kz*mz);
for jj=1:c
q2 = q1.^z(jj).*circ;
Ex(:,:,jj)=fftshift(fft2(q2.*Gx,k,k));
Ey(:,:,jj)=fftshift(fft2(q2.*Gy,k,k));
Ez(:,:,jj)=fftshift(fft2(q2.*Gz,k,k));
end
M1=Ex(k/2,:,:);
N1=squeeze(M1).';
E1=N1(l1+1,:);
M2=Ey(k/2,:,:);
N2=squeeze(M2).';
E2=N2(l1+1,:);
M3=Ez(k/2,:,:);
N3=squeeze(M3).';
E3=N3(l1+1,:);
c=3*10^8;
E=[E1 E2 E3];
B=E/c;
S=crossprodut(E,B);
thanks in advance
  댓글 수: 1
Jan
Jan 2012년 10월 4일
Please explain, what your code does and what it does not solve. Formatting the code properly would be a good idea also. It has been explained hundrets of times in this forum already, so I'm convinced you will find the reuquired information by your own.

댓글을 달려면 로그인하십시오.

답변 (1개)

Matt J
Matt J 2012년 10월 4일
Use the CROSS command?

Community Treasure Hunt

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

Start Hunting!

Translated by