*No products are associated with this question.*

Answer by Walter Roberson
on 21 Dec 2011

Accepted answer

>> t = linspace(0,4*pi,100); >> [x,y] = ndgrid(t,t); >> u = sin(4*x+8*y); >> v = cos(4*x+8*y); >> quiver(x,y,u,v)

Show 1 older comment

Walter Roberson
on 22 Dec 2011

I spend so much time working that I reserve my facebook account for communication that has nothing to do with work, such as chatting with my large number of cousins.

justin Taylor
on 22 Dec 2011

So we could be good friends!

justin Taylor
on 24 Dec 2011

Merry chistmat !

Related Content

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
## 16 Comments

## Image Analyst (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/24260-plot-field-vector#comment_53166

Yeah, so? How about you explain something in English rather than just display a bunch of code? If there's a problem with quiver or inline, have you tried to figure it out by looking up the arguments and examples in the help? If you got an error, why didn't you post the error???

## justin Taylor (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/24260-plot-field-vector#comment_53180

http://i1203.photobucket.com/albums/bb396/kidstar079/Capture-2.png

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/24260-plot-field-vector#comment_53187

I misread the original code; sub2ind() was not an appropriate solution.

What error message did you get originally? The sizes look okay to me when I work them through mentally.

## Naz (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/24260-plot-field-vector#comment_53189

I used the code you posted and did not get any errors

## justin Taylor (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/24260-plot-field-vector#comment_53200

Version Matlab Naz Use ?

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/24260-plot-field-vector#comment_53202

It would save time if you were to post the error message that *you* encountered, or at least describe what the difference was between the output you got and the output you expected?

## justin Taylor (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/24260-plot-field-vector#comment_53205

sorry to bother you, I see you are very enthusiastic and I like that in your, i want find area surface limit x,y,z.

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/24260-plot-field-vector#comment_53209

You want to find the surface area of a quiver plot??

What exactly are you asking us in this question? Are you encountering an error in the code you posted?

If you were asking us about how to find the area surface limit x,y,z then your code would have to have z in it somewhere. The closest you show is your F, which is only 2D, and "surface area" is not a phrase that is applied to a 2D object (the 2D term is just "area")

Do not just post code and expect us to know what you want to do!

## justin Taylor (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/24260-plot-field-vector#comment_53224

sorry ! because ihave got the wrong problem and i come from Viet Nam so my English not good! I hope you sympathize. I fix it.

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/24260-plot-field-vector#comment_53227

Okay, so you have defined an x, y, and z, and you have indicated that you need to use quiver(). You have not, though, indicated what is to be done. quiver() requires an x and y (but not a z), and it requires two vector fields, u and v. You do not have enough variables defined, not unless you want to use quiver(x,y) with the x and the y acting as u and v matrices.

http://www.mathworks.com/help/techdoc/ref/quiver.html

Are you certain that you want to write the value sin(4*x+8*y) over top of x? And then to use the new x in calculating cos(4*x+8*y) that you then write over the old y ?

## justin Taylor (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/24260-plot-field-vector#comment_53230

Okay! i fix it.

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/24260-plot-field-vector#comment_53234

I see you have edited your code, but you have not yet indicated what is to be done. What is the relationship between the F matrix and the quivers to be drawn? For the quiver() call you need an "x", a "y", a "u" and a "v" parameter: do the "x" and "y" parameters you wish to use correspond to your "x" and "y" variables?

## justin Taylor (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/24260-plot-field-vector#comment_53241

don't have u or v.

## Naz (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/24260-plot-field-vector#comment_53242

Can you edit your question and provide all information that is given to you as well as requirements?

## justin Taylor (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/24260-plot-field-vector#comment_53244

OK !

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/24260-plot-field-vector#comment_53300

You removed all the useful information from your question...