Azzera filtri
Azzera filtri

How to change default incremental coordinate values of xData, yData in streamline plot?

1 visualizzazione (ultimi 30 giorni)
When I extract the coordinate of Streamlines it gives coordinate values with default 0.1 spacing. I want to change the values but can't find it.
load wind
xlim = 0:1:255;
ylim = -256:1:0;
[verts averts] = streamslice(u,v,w,10,10,10);
s_slice = streamline([verts averts]);
spd = sqrt(u.*u + v.*v + w.*w);
hold on; slice(spd,10,10,10);
colormap(hot)
shading interp
view(30,50); axis(volumebounds(spd));
camlight; material([.5 1 0])
xData = get(s_slice, 'XData');
yData = get(s_slice, 'YData');

Risposta accettata

Gayatri Rathod
Gayatri Rathod il 1 Mar 2023
Hi Suman,
To change the default incremental coordinate values of xData and yData in a streamline plot, you need to modify the spacing parameter when calling the streamslice function.
The streamslice function has the following syntax:
[verts, averts] = streamslice(X, Y, Z, U, V, W, startx, starty, startz)
where X, Y, and Z specify the coordinates of the data grid, and U, V, and W specify the vector components. The startx, starty, and startz arguments specify the starting points of the streamlines.
To change the spacing of the streamlines, you can modify the startx, starty, and startz arguments. For example, you can specify the spacing to be 0.5 as follows:
spacing = 0.5;
[x, y, z] = meshgrid(xlim, ylim, zlim);
startx = x(1:spacing:end, 1:spacing:end, 1:spacing:end);
starty = y(1:spacing:end, 1:spacing:end, 1:spacing:end);
startz = z(1:spacing:end, 1:spacing:end, 1:spacing:end);
[verts, averts] = streamslice(u, v, w, [], [], [], startx, starty, startz);
Here, meshgrid is used to create a grid of starting coordinates with the same dimensions as u, v, and w and startx, starty, and startz are created by selecting every spacing element from the grid. This will create a grid of starting coordinates with 0.5 spacing in all three dimensions.
You can read more about the streamslice and meshgrid functions from the following documentations: streamslice Function, meshgrid Function
Hope it helps!
Regards,
Gayatri Rathod

Più risposte (0)

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by