Streamslice at different plane

17 visualizaciones (últimos 30 días)
Borda
Borda el 15 de Jun. de 2014
Respondida: Daniel Frisch el 12 de Dic. de 2014
I've got some trouble using streamslice function. See, I have some vector data and what I would like to do is to make a streamslice at a constant y value (XZ plane). In the example of the function's help a slice is made at a constant z (XY plane) with:
streamslice(x,y,z,u,v,w,[],[],[5])
So I tried to make a slice at a constant y value with
streamslice(x,y,z,u,v,w,[],[yValue],[])
but Matlab keeps throwing me back this error
Error using stream2 (line 47)
U,V must all be size 2x2 or greater.
Error in streamline (line 61)
verts = stream2(u,v,sx,sy,options);
Error in streamslice (line 236)
h = streamline(cax,[vertsout avertsout]);
What could be the problem?

Respuestas (1)

Daniel Frisch
Daniel Frisch el 12 de Dic. de 2014
I had the same problem with an electrical field Ex, Ey, Ez and contacted the Mathworks support. They gave me this comprehensive answer:
The reason this is occurring is that your 'Ex', 'Ey', and 'Ez' matrices are all NaN at the origin (index 21,21,21). When "streamslice" tries to interpolate near the origin, it uses this NaN value, and it will not display a slice if there is a NaN value in the slice.
In order to avoid this issue, you can either avoid defining your grid at the origin, or you can use the 'spline' method instead of 'linear' as it will ignore all NaN values when performing interpolation. Note that for 'cubic' you could not use '0.1' because it would use the NaN value at the origin as an interpolating point for that slice.
If you do use 'spline', then you will see many warnings about the NaN values. You can avoid these warnings with the command:
>> warning('off','MATLAB:interp3:NaNstrip');
I suggest you turn these warnings back on with this command once you are done:
>> warning('on','MATLAB:interp3:NaNstrip');

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by