# get the far field data ux = farfieldux("Monitor1",1,251,200); uy = farfielduy("Monitor1",1,251,200); f = getdata("Monitor1","f"); E2 = farfield3d("Monitor1",1:length(f),251,200); # visualize with the usual plot if(length(f) > 1) { polarimage(ux,uy,E2(:,:,1)); } else { polarimage(ux,uy,E2); } # create an unstructured grid and element matrix, C Ux = meshgridx(ux,uy); Uy = meshgridy(ux,uy); Uz = real( sqrt(1-Ux^2-Uy^2) ); nRect = (length(ux)-1)*(length(uy)-1); C = matrix(2*nRect,3); nx = length(ux); ny = length(uy); pos = find( (Ux != max(ux)) & (Uy != max(uy)) ); posA = pos(find(Uz(pos) | Uz(pos+1) | Uz(pos+1+nx))); cPos = 1:length(posA); C(cPos,1) = posA; C(cPos,2) = posA+1; C(cPos,3) = posA+1+nx; posB = pos(find(Uz(pos) | Uz(pos+1+nx) | Uz(pos+nx))); cPos = length(posA) + (1:length(posB)); C(cPos,1) = posB; C(cPos,2) = posB+1+nx; C(cPos,3) = posB+nx; C = C(1:(length(posA)+length(posB)),:); # construct a dataset and visualize it ff = unstructureddataset("ff",Ux,Uy,Uz,C); ff.addparameter("f",f,"lambda",c/f); ff.addattribute("E2",reshape(E2,[nx*ny,length(f)])); visualize(ff);