Plot 2D vector field
128 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Emerson De Souza
el 31 de Mayo de 2011
Editada: Dyuman Joshi
el 6 de Dic. de 2023
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 comentario
Qiujie Meng
el 2 de Abr. de 2019
Movida: Dyuman Joshi
el 6 de Dic. de 2023
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......?
Respuesta aceptada
Más respuestas (1)
Brijesh
el 6 de Dic. de 2023
clc
clear all
syms x y
f = input('Enter:');
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 comentario
Dyuman Joshi
el 6 de Dic. de 2023
Editada: Dyuman Joshi
el 6 de Dic. de 2023
@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.
Ver también
Categorías
Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!