Azzera filtri
Azzera filtri

How to plot for physical bodys and streamlines?

4 visualizzazioni (ultimi 30 giorni)
David Scidmore
David Scidmore il 13 Feb 2021
Risposto: Pratyush Roy il 16 Feb 2021
I'm trying to plot a streamline and am learning MatLAB as I go along (coding is definately not for me) for my class. I have the code below, but I end up with figure below. This happens to me no matter what I plot. I'm curious if I'm missing something in order to get lines to show up? I am trying to get a image similar to the bottom one.
x = [0:10];
y = [0:5];
E = 2.50;
U = 1;
TV = 1;
Pi=3.14;
Psi = E/2;
Psist = -E/(2*pi*U);
R = (E/2*Pi*U)*((Pi-TV)/sin(TV));
u = U + (E/2*pi*R)*cos(TV);
v = (E/2*pi*R)*sin(TV);
plot(u,v)
  1 Commento
dpb
dpb il 13 Feb 2021
You never evaluate the correlation over x, y -- you define a vector of values for each but never reference either anywhere else.
So, your u, v values are only a single value and one pixel point is generally just too small to show up on the screen. You did plot one point, you just can't see it. Try
plot(u,v,'*')
to prove that.
To evaluate the values over a x,y grid such as your figure, you need to evaluate the functional at a bunch of points across both x and y although since this is symmetric around y==0, you could compute just one side there and reflect it around the y axis. Altogether, it's probably simpler to just compute it all directly. You will need to build in some logic for the branch points, though.
See
doc meshgrid
example for plotting a surface for an example of similar kind of thing over the x-y plane although note that with R2016b and latter implicit expansion can save explicit calculation of the full XY mesh.

Accedi per commentare.

Risposte (1)

Pratyush Roy
Pratyush Roy il 16 Feb 2021
Hi David,
As rightly pointed out, the plot only displays a point since u and v values are not arrays but single points.
To obtain a 2D streamline plot, you might need the arrays containing positions(x,y), directional components(u,v) at those points as well as the starting positions of the streamlines. The documentation link for streamline might be helpful.
Hope this helps!

Categorie

Scopri di più su Vector Fields in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by