Skip to content

Commit

Permalink
Update divergence_example_plots.m
Browse files Browse the repository at this point in the history
Streamline 나오도록 update
  • Loading branch information
angeloyeo committed Oct 19, 2020
1 parent c4419f5 commit 8f425ab
Showing 1 changed file with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@
colormap(jet); colorbar
alpha(0.2)

% xy 평면에서 없어지고 생겨나는 벡터장
%% xy 평면에서 없어지고 생겨나는 벡터장
clear; close all; clc;

[x,y]=meshgrid(-1:0.9:10,-1:0.9:10);
% [x,y]=meshgrid(-1:0.9:10,-1:0.9:10);
xx = linspace(-1, 10, 10);
yy = xx;
[x,y]=meshgrid(xx, yy);

u=(x-2).*(x-8);
v=(y-2).*(y-8);
Expand All @@ -34,12 +37,20 @@
xlabel('x');
ylabel('y');


div=divergence(x,y,u,v);

hold on;
imagesc(-1:0.9:10,-1:0.9:10,transpose(div))
colormap(jet); y=colorbar;
ylabel(y, 'divergence')
imagesc(xx, yy ,transpose(div))
colormap(jet); cbar=colorbar;
ylabel(cbar, 'divergence')
alpha(0.2)
axis tight
axis tight

%% animation
figure;
[verts, averts] = streamslice(x, y, u, v);

sl = streamline([verts, averts]);
iverts = interpstreamspeed(x, y, u, v, verts, 0.01);
streamparticles(iverts, 300, 'Animate', 15, 'FrameRate', 40, 'Markersize', 5);

0 comments on commit 8f425ab

Please sign in to comment.