Quiverplot of r hat / r squared in matlab

  • Context: MATLAB 
  • Thread starter Thread starter Waxterzz
  • Start date Start date
  • Tags Tags
    Matlab
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 1K views
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:

MwQ72tw.jpg


What am I doing wrong?
 
Physics news on Phys.org
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.