How to plot streamlines using Streamslice?

조회 수: 16 (최근 30일)
Kelvin Ang
Kelvin Ang 2022년 9월 10일
답변: Kelvin Ang 2022년 9월 11일
Hey there, I'm trying to generate a streamline plot but I keep getting an error message saying something is wrong at line 14. Can anybody help?
edit: Sorry, I forgot to mention that the streamlines vary with time so I'll probably be recording multiple plots

답변 (2개)

KSSV
KSSV 2022년 9월 10일
[X,Y] = meshgrid(-5:0.1:5,-5:0.1:5) ;
u = X.*(1+2*Y) ;
v = Y ;
streamslice(X,Y,u,v)

Kelvin Ang
Kelvin Ang 2022년 9월 11일
So I think I may have figured it out
clc; clear all; close all
syms x y u v t c
u(x,y,t) = x*(1+2*t); %defined as a function of x, y, and t since streamline is time varying in this case
v(x,y,t) = y;
St = int(u,y)==int(v,x)
St(x, y, t) = 
figure(1) %for plotting the streamlines
[x y] = meshgrid(-5:0.1:5 -5:0.1:5);
t = 0;
u2 = u(x,y,t); %remember to keep "t"
v2 = v(x,y,t);
streamslice(x,y,u2,v2)
title('t = 0') %rinse and repeat for as many time intervals as needed
xlabel('x')
ylabel('y')
figure(2)
[x y] = meshgrid(-5:0.1:5 -5:0.1:5);
t = 0.5;
u2 = u(x,y,t);
v2 = v(x,y,t);
streamslice(x,y,u2,v2)
title('t = 0.5')
xlabel('x')
ylabel('y')

카테고리

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

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by