# How to make color magnitude by quiver plot?

17 vues (au cours des 30 derniers jours)
Masoud Taleb le 14 Oct 2020
Modifié(e) : Masoud Taleb le 14 Oct 2020
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
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)
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponses (1)

KSSV le 14 Oct 2020
##### 3 commentairesAfficher 1 commentaire plus ancienMasquer 1 commentaire plus ancien
KSSV le 14 Oct 2020
What errors you getting?
Masoud Taleb le 14 Oct 2020
Modifié(e) : Masoud Taleb le 14 Oct 2020
First link stays in play mode and does not give any plot at all (I stayed 20 min without getting response)
Second link shows following error. I tried to fix it but was not successful.
Unrecognized function or variable 'samesize'.
Error in quiverc (line 129)
if ~isempty(samesize)
Error in Untitled (line 20)
quiverc(x,y,data_x,data_y);
Third link brings a ghraph which is totally something else.

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Vector Fields dans Help Center et File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by