interpstreamspeed problem, only getting 1 pair of values from each 10000 pair cell

2 ビュー (過去 30 日間)
Michael BIggs
Michael BIggs 2018 年 11 月 25 日
I'm having a problem with interpstreamspeed and I can't figure out what it is.
I have two sets of vertices, both calculated from the same set of original data. When I use interpstreamspeed on one set, everything is fine, but when I do it on the other, I only get 1 set of values for each vertice and I'm not sure why.
Relevant bits of program
[x y] = meshgrid(-4.55:0.02:4.61, -4.55:0.02:4.61);
% data for positive charge at (-1,0) and negative charge at (1,0)
V1 = 1./sqrt((x+1).^2+y.^2);
V2 = -1./sqrt((x-1).^2+y.^2);
V = V1+V2;
[Ex, Ey] = gradient(-V,0.02,0.02);
% first set of vertices start from a small circle around charge 1
[theta r] = meshgrid(0:pi/12:2*pi, 0.01);
[startx starty] = pol2cart(theta, r);
verts = stream2(x,y,Ex,Ey,startx-1,starty);
% second set of vertices fill in gaps to right of charge 2
for n = 1:length(verts)
if verts{1,n}(end,1)<startx
startx2 = [startx2 verts{1,n}(end,1)];
starty2 = [starty2 verts{1,n}(end,2)];
end
end
verts2 = stream2(x,y,Ex,Ey,-startx2,starty2);
% problem part, interpstreamspeed gives me two cell arrays, but the one for iverts2 contains many pairs of xy data in each cell
% iverts only contains the first xy pair in verts in each cell
iverts = interpstreamspeed(x,y,Ex,Ey,verts,0.1);
iverts2 = interpstreamspeed(x,y,Ex,Ey,verts2,0.1);
Any help would be much appreciated

回答 (0 件)

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by