How to plot contour as a function of radius and height?
Show older comments
I have written a code for magnetic field on surface as a function of radius and height.. I want graph of variation in magnetic field on the surface as the magnetic lines appear i.e., diverging.. The code is here: %magnetic field normal to the surface
clc;
clear all;
close all;
hob=2.5*10^3;
h=200000:100000:5000000;
c=3*10^8; %m/s velocity
len1=length(h);
bsquare=10^10:(10^15-10^10)/(len1-1):10^15; %m2
b=bsquare.^0.5;
len2=length(b);
area=bsquare.*pi;
ho=zeros(len1,len2); %mag field
fh=zeros(len1,len2); %electron gyro freq
wh=zeros(len1,len2); %ang freq
m=9.1094*10^-28; %gram electron mass
e=1.6*10^-19; %charge
for i=1:len1
for j=1:len2
ho(i)=hob*(1-(h(i)/((h(i)^2)+bsquare(j))^0.5));
wh(i)=e*ho(i)/(m*c);
fh(i)=wh(i)/(2*pi);
end
end
figure;
t=[h:b];
contour3(b,h,ho,128);%logspace(-2, 3, 20));
% plot3(b,h,ho);
xlabel('x-radius');ylabel('y-height');zlabel('z-magnetic field');
grid on;
hold on;
1 Comment
Saumitra Lalsare
on 24 Sep 2017
Edited: Walter Roberson
on 24 Sep 2017
Answers (0)
Categories
Find more on Contour Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!