Effacer les filtres
Effacer les filtres

Superimpose the graph of a function onto a streamline field

1 vue (au cours des 30 derniers jours)
David Santo
David Santo le 11 Oct 2020
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')

Réponse acceptée

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

Plus de réponses (0)

Catégories

En savoir plus sur Vector Fields dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by