Plot electric field in plane
Afficher commentaires plus anciens
Good afternoon,
the png file shows the magnitude of an electric field
in a plane, which was calculated by means of an electromagnetic field solver. I exported the field data to a txt file (see attachement), as I want to plot these data in Matlab. How can I create a plot, whose result looks similar to the attached png file?
Thank you very much for your help!
Réponse acceptée
Plus de réponses (1)
Hi!
Perhaps this:
clear
close all
Elec_F = readmatrix('data.txt') ;
x = Elec_F(:, 1) ;
y = Elec_F(:, 2) ;
z = Elec_F(:, 3) ;
Ef =abs(sqrt((Elec_F(:,4) + 1i*Elec_F(:,5)).^2 + (Elec_F(:, 6) + 1i*Elec_F(:, 7)).^2 + ...
(Elec_F(:, 8) + 1i*Elec_F(:, 9)).^2) );
scatter3(x,y,z, [] , Ef,"filled", "square", 'MarkerFaceColor','flat')
box on
zlim([0 1.5])
xlim([min(x) max(x)])
ylim([min(y) max(y)])
xticks([])
yticks([])
zticks([])
ax = gca ;
ax.BoxStyle = "full" ;
view([-59.59 22.36])
colorbar
Note that with dense data you will get better resolution.
- Abderrahim
1 commentaire
Catégories
En savoir plus sur Sparse Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





