Plot with a imaginary input
Show older comments
Hello ! I want to plot in a 2Dgrid the magnetic and gravimetric potential of a point, in the spectral domain. However I am not very good in coding and I master only one way to do in it in the temporal domain. And this method seems not to work with a imaginary input ? Somebody can tell by what I can replace meshgrid and pcolor in my code ?
%%%Donnees et Valeurs
% p point de mesure : rho densite de la masse m ; j aimentation du dipole d ; R champ regional magnetique
X=[-50 : 0.5 : 50];
Y=[-45 : 0.5 : 55];
z=0;
[x,y] = meshgrid(X,Y);
p=[-5 2 10];
rho= 2;
G= 6.674*10^(-11);
j=[1 1 1];
R= [10 10 10];
s=sqrt(x^2+y^2);
%%Gravimetrie
% Potentiel gravimetrique
V = G*rho*2*pi*exp(i*x*p(1))*exp(i*y*p(2))*exp(-p(3)*s)./(s);
%%Plot
figure
subplot (2,2,1)
hp1 = pcolor(X,Y,V);
set(hp1,'EdgeColor','None');
colorbar
title('Potentiel gravimétrique')
Answers (1)
You probably just want to use
abs( V )
i.e.
hp1 = pcolor(X,Y,abs(V));
2 Comments
Adriane Clerc
on 12 Dec 2016
Steven Lord
on 12 Dec 2016
Can you post a link to a picture that shows the specific type of plot you hope to reproduce? That may be easier to understand that a text description of the behavior.
Categories
Find more on Mathematics in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!