Superimpose the graph of a function onto a streamline field

4 visualizaciones (últimos 30 días)
Hi, I have to plot a streamline field given a 2D velocity vector and then superimpose 2 other functions (streamlines at given points) over it. I have already written the code for the streamline field, but am lost as to how I can plot the other functions along with the field in the same figure. How can I go about doing this? Thanks, David
The code I am using:
close all;
clc;
clear all;
xmin=-1;
xmax=1;
ymin=-1;
ymax=1;
h=0.6;
[x,y] = meshgrid(xmin:h:xmax,ymin:h:ymax);
u = y./(x.^2+y.^2);
v = -x./(x.^2+y.^2);
figure
quiver(x,y,u,v)
startx = xmin:h:xmax;
starty = ymin:h:ymax;
h = streamline(x,y,u,v,startx,starty);
set(h,'color','red')

Respuesta aceptada

Gaurav Garg
Gaurav Garg el 19 de Oct. de 2020
Hey David,
You can try using hold on function.
One such example can be found here.

Más respuestas (0)

Categorías

Más información sobre Vector Fields en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by