Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

to draw divergence of a vector in 2d

Status
Not open for further replies.

tinfing

Electrical
Jul 1, 2014
1
DE
hi,
i am new to matlab. i need to draw divergence of function in 2d xy-graph. i found acode with help of that code i can plot vector it self and its 3d divergence. i have no idea how to create 2d of that same divergence.
below is the code i am using
x= -11:0.5:11 ;
y = x;
[x,y]=meshgrid(x,y);
div1=divergence(x,y,cos((pi*x)/7)*sin((pi*y)/7),cos((pi*y)/7)*sin((pi*x)/7));
figure;
subplot(1,2,1);
quiver(x,y,cos((pi*x)/7)*sin((pi*y)/7),cos((pi*y)/7)*sin((pi*x)/7));
title('funktion');
subplot(1,2,2);
plot(div1);
title('divergenz');
thanks for ur help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top