How to make color magnitude by quiver plot?
Show older comments
Hello
I have a problem with quiver plot. My code makes the plot perfectly but I would like to have also color magnitude on it. I mean the electric field can be observed by color change when arrow rotates. I appreiate all the helps in this regard. My code and sample date is below:
clc
clear all
Ex=csvread('position2_Ex_new.csv');
Ey=csvread('position2_Ey_new.csv');
theta = Ex(2:end, 1);
phi = Ex(1, 2:end);
data_x = Ex(2:end,2:end);
data_x = transpose(data_x);
% data_x = max(data,0);
data_y = Ey(2:end,2:end);
data_y = transpose(data_y);
% data_y = max(data,0);
[theta_,phi_]= meshgrid(theta,phi);
r=1e-3;
x=r*sin(theta_).*cos(phi_);
y=r*sin(theta_).*sin(phi_);
z=r*cos(phi_);
quiver(x,y,data_x,data_y);
% xlabel('x');
% ylabel('y');
set(gca,'XDir','reverse');
set(gca,'DataAspectRatio',[10 10 10])
camroll(-90)
Answers (1)
KSSV
on 14 Oct 2020
0 votes
3 Comments
Masoud Taleb
on 14 Oct 2020
Edited: Masoud Taleb
on 14 Oct 2020
KSSV
on 14 Oct 2020
What errors you getting?
Masoud Taleb
on 14 Oct 2020
Edited: Masoud Taleb
on 14 Oct 2020
Categories
Find more on Vector Fields 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!