Plotting Quiver with Contour

2 views (last 30 days)
Hasan Al Tarify
Hasan Al Tarify on 28 Oct 2021
Hello,
I need help with plotting using Quiver function such that the arrows of this function follows the contour lines. The equations in the following code are right since I have a got the desired contour plot. PLease note that 𝑢=𝜕𝜓/𝜕𝑦,𝑣=−𝜕𝜓𝜕𝑥. I have attached a picture as an example. Thanks
clc
clear all
syms x y
L = 10000;
H = 6000;
sig = 0.03;
alp = 0;
r1 = (-alp+sqrt(alp^2+4*pi^2/H^2))/2;
r2 = (-alp-sqrt(alp^2+4*pi^2/H^2))/2;
x = linspace(0,L,100);
y = linspace(0,H,100);
[X,Y] = meshgrid(x,y);
p = (sig*H^2/pi^2).*sin(pi*Y/H).*(((exp(r2*L)-1).*exp(r1*X)+(1-exp(r1*L)).*exp(r2*X))/(exp(r2*L)-exp(r1*L))-1);
U = (sig*H/pi).*cos(pi*Y/H).*(((exp(r2*L)-1).*exp(r1*X)+(1-exp(r1*L)).*exp(r2*X))/(exp(r2*L)-exp(r1*L))-1);
V = -1.*(sig*H^2/pi^2).*sin(pi*Y/H).*(((r1.*exp(r2*L)-1).*exp(r1*X)+r2.*(1-exp(r1*L)).*exp(r2*X))/(exp(r2*L)-exp(r1*L))-1);
contour(X,Y,p)
hold on
quiver(X,Y,U,V)
hold off
xlabel('X');
ylabel('Y');
title('sig = 0.03, alp = 0');

Answers (0)

Categories

Find more on Vector Fields in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!