Use quiver to change points into vectors?

1 回表示 (過去 30 日間)
Jenn Lee
Jenn Lee 2011 年 10 月 24 日
If I use rand(n) to create a matrix of random numbers, can I use quiver to plot them as random vector arrows? Or do I need to use something else?
I want to be able to generate random values then plot them as vectors which can be later used to generate a new graph that will be based on the random vectors.

回答 (1 件)

Amith Kamath
Amith Kamath 2011 年 10 月 29 日
I could answer this if the n in rand(n) is either 2 or 3. If it's more than 3, I'm afraid 4 dimensional vector visualization is beyond the scope of our imagination, almost!
This may help:
function [] = visualizerndvect(numofvectors, dimension)
if dimension <= 3 Data = rand(numofvectors,dimension); if dimension == 2 figure, quiver(zeros(size(Data,1),1),zeros(size(Data,1),1),Data(:,1),Data(:,2)); else if dimension == 3 figure, quiver3(zeros(size(Data,1),1),zeros(size(Data,1),1),zeros(size(Data,1),1),Data(:,1),Data(:,2),Data(:,3)) end end else fprintf('Dimension beyond visualization capacity!\n'); end
Thanks!
  1 件のコメント
Jenn Lee
Jenn Lee 2011 年 11 月 3 日
I've been thinking about what I need to do and I came up with:
I need to create a nonlinear differentiable equation with random initial conditions. How can I do this?
Also, how do I plot differentiable equations with vector arrows?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeVector Fields についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by