Superimpose the graph of a function onto a streamline field

조회 수: 4 (최근 30일)
David Santo
David Santo 2020년 10월 11일
답변: Gaurav Garg 2020년 10월 19일
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')

채택된 답변

Gaurav Garg
Gaurav Garg 2020년 10월 19일
Hey David,
You can try using hold on function.
One such example can be found here.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Vector Fields에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by