Hi
I have a table T of four columns x,y,u,v,
where x and y are the coordinates
and u and v are the values of the x and y components, respectively.
Thus, T represents a two-dimensional vector field.
For example, let
T=
1 3 -1 -1
1 4 0.500000000000000 -0.500000000000000
2 3 -0.250000000000000 0.250000000000000
2 4 0.100000000000000 0.100000000000000
I want to plot a 2-D vector field from this table!!!
I tried using the function:
coneplot(T)
but became the following error message:
??? Error using ==> coneplot>parseargs at 365
Wrong number of input arguments.
Error in ==> coneplot at 64
[x y z u v w cx cy cz s color quiv method nointerp] =
parseargs(nargs,args);
It seems that coneplot works only for 3-D.
Can someone tell me how to change this command line?
Thank you
Emerson

댓글 수: 1

Qiujie Meng
Qiujie Meng 2019년 4월 2일
이동: Dyuman Joshi 2023년 12월 6일
This is my code:
%%%%%%%%%%%%%%%%%%
close all;clc;clear all;
velocity=load('velocity100POINTS.txt');
x=velocity(:,1);
y=velocity(:,2);
u=velocity(:,3);
v=velocity(:,4);
figure
quiver(x,y,u,v)
%%%%%%%%%%%%%%%%%%%%%
Although my file has vectors,why the figure is like that......?
QQ截图20190402211109.png
QQ截图20190402211333.png

댓글을 달려면 로그인하십시오.

 채택된 답변

Walter Roberson
Walter Roberson 2011년 5월 31일

0 개 추천

Sounds like you are looking for quiver

댓글 수: 3

Emerson De Souza
Emerson De Souza 2011년 5월 31일
Thanks Walter,
yes, it works.
I first did the following:
>> x=T(:,1);
>> y=T(:,2);
>> u=T(:,3);
>> v=T(:,4);
and finally plot with
quiver(x,y,u,v)
But is there a way to plot directly from table T
without needing to define new variables x,y,u,v?
Thanks in advance for your attention
Emerson
Walter Roberson
Walter Roberson 2011년 5월 31일
quiver(T(:,1),T(:,2),T(:,3),T(:,4))
Emerson De Souza
Emerson De Souza 2011년 6월 2일
Thank you Walter
Wish you a nice night
Emerson

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Brijesh
Brijesh 2023년 12월 6일

0 개 추천

clc
clear all
syms x y
f = input('Enter:');
Unable to run the 'fevalJSON' function because it calls the 'input' function, which is not supported for this product offering.
p = inline(vectorize(f(1)),x,y);
q = inline(vectorize(f(2)),x,y);
x = linspace(-1,1,10);
y = x;
[X, Y] = meshgrid(x,y);
U = p(X,Y)
V = q(X,Y)
quivert(X,Y,U,V,1)
axis on;

댓글 수: 1

Dyuman Joshi
Dyuman Joshi 2023년 12월 6일
편집: Dyuman Joshi 2023년 12월 6일
@Brijesh, how exactly does your answer answers the question asked, that too 12 years ago and with an accepted answer.
There is no function as quivert and using inline and vectorize is not recommended.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

태그

질문:

2011년 5월 31일

편집:

2023년 12월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by