In Matlab how do I change the arrow head style in quiver plot?

前端 未结 5 1384
耶瑟儿~
耶瑟儿~ 2020-12-05 03:23

I would like to change the default arrow head style in quiver plot. How can I change it?

5条回答
  •  日久生厌
    2020-12-05 03:55

    The file refresh.m located in folder ...\MATLAB\...\toolbox\matlab\specgraph\@specgraph\@quivergroup\@quivergroup contains the following lines:

    %// Arrow head parameters
    alpha = .33;  %// Size of arrow head relative to the length of the vector
    beta = .25;  %// Width of the base of the arrow head relative to the length
    

    Changing the values of alpha and beta achieves the desired effect.

    However, this entails modifying Matlab's files, and thus it's not recommended. If you do it, keep a copy of the original refresh.m file.


    Results using the example code that appears in quiver's help:

    [x,y] = meshgrid(-2:.2:2,-1:.15:1);
    z = x .* exp(-x.^2 - y.^2); [px,py] = gradient(z,.2,.15);
    quiver(x,y,px,py), hold off, axis image
    
    • With original parameters (alpha = .33; beta = .25;):

      enter image description here

    • With alpha = .5; beta = .5;:

      enter image description here

提交回复
热议问题