Quiverplot of r hat / r squared in matlab

  • Topic: MATLAB 
  • Thread starter Waxterzz
  • Start date
  • Tags Tags
    Matlab
2 replies · 2K views · last reply
Waxterzz
Messages
82
Reaction score
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:

Empty MATLAB plot with axes from -2 to 2 on both x and y, showing only a regular grid of small dots and no arrows.


What am I doing wrong?
 
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.
 
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.