Quiverplot of r hat / r squared in matlab

  • MATLAB
  • Thread starter Waxterzz
  • Start date
  • Tags
    Matlab
In summary, the conversation discusses a problem with quiverplotting a function in MATLAB. The problem is that for one X,Y pair, the resulting X1,Y1 pair turns out to be (X1 = -0.89, Y1 = -inf), causing one arrow to be much larger than the others. The conversation also addresses a potential mistake with the denominator of the function. The issue is resolved when the typing error is corrected.
  • #1
Waxterzz
82
0
Hi, I want to quiverplot this function in matlab.

>> [X Y] = meshgrid(-2:.2:2,-2:.2:2);
>> X1 = X./(X.^2+Y.^2).^1.5;
>> Y1 = Y./(X.^2+Y./2).^1.5;
>> quiver(X,Y,X1,Y1)
>>

I got this:

MwQ72tw.jpg


What am I doing wrong?
 
Physics news on Phys.org
  • #2
I think the problem is that for one X,Y pair, namely (X = -1, Y = -2), the resulting X1,Y1 pair turns out to be ( X1 = -0.89, Y1 = -inf ) and with one arrow being so huge, all the others become undetectable...I think you may be able to demonstrate this by making sure you do NOT plot the huge arrow...pick the limits of your graph to be, say, from 0 to 2...and I think you will start seeing what you expect.

By the way, are the denominators supposed to be the same or not? the Y divided by 2 does not fit the pattern...from my ignorant point of view.
 
  • #3
gsal said:
I think the problem is that for one X,Y pair, namely (X = -1, Y = -2), the resulting X1,Y1 pair turns out to be ( X1 = -0.89, Y1 = -inf ) and with one arrow being so huge, all the others become undetectable...I think you may be able to demonstrate this by making sure you do NOT plot the huge arrow...pick the limits of your graph to be, say, from 0 to 2...and I think you will start seeing what you expect.

By the way, are the denominators supposed to be the same or not? the Y divided by 2 does not fit the pattern...from my ignorant point of view.

Omg. Yes. I looked over it.For some reason I made the same Typing error over and over again.
Y is wrong.
 

What is a quiverplot in MATLAB?

A quiverplot is a type of 2D plot in MATLAB that displays vector data using arrows. It is commonly used to visualize vector fields and their magnitudes and directions.

How do I create a quiverplot of r hat / r squared in MATLAB?

To create a quiverplot of r hat / r squared in MATLAB, you can use the quiver function. This function takes in the coordinates of the starting points of the vectors, the components of the vectors, and optional arguments for customizing the plot.

What is r hat / r squared in MATLAB?

r hat / r squared is a mathematical expression used to calculate the direction and magnitude of a vector. In MATLAB, r hat represents the unit vector in the direction of the vector, and r squared represents the magnitude of the vector squared.

Can I customize the appearance of the quiverplot in MATLAB?

Yes, you can customize the appearance of the quiverplot in MATLAB by using optional arguments in the quiver function. Some customization options include changing the color, size, and style of the arrows, adding labels and a title, and adjusting the axis limits.

How can I interpret the quiverplot of r hat / r squared in MATLAB?

The quiverplot of r hat / r squared in MATLAB displays the direction and magnitude of the vectors in the vector field. The arrows point in the direction of the vectors, and the length of the arrows represents the magnitude of the vectors. The longer the arrow, the larger the magnitude of the vector. Additionally, the color of the arrows can be used to represent a third variable, such as the vector's speed or temperature.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
992
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
121
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
560
  • MATLAB, Maple, Mathematica, LaTeX
Replies
14
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
817
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
Back
Top