How to plot isosurfaces in cylindrical polars?

1 view (last 30 days)
I'm trying to plot isosurfaces of magnetic field strength for a field defined in cylindrical polars:
ModB = (nrpts,napts,nzpts);
For a given z I can plot contours with x=r*cos(theta) and y=r*sin(theta) (see below)
However if i take the same approach for the isosurfaces I get the following error message:
Error using griddedInterpolant The grid was created from grid vectors that were not strictly monotonic increasing.
Error in interp3 (line 141) F = griddedInterpolant(X, Y, Z, V, method,extrap);
Error in isonormals (line 76) n(:,1)=interp3(x, y, z, nx, verts(:,1), verts(:,2), verts(:,3));
Error in isosurface (line 124) isonormals(x,y,z,data, p);
I understand that this is because neither x or y are monotonic because of the nature of cos and sin, but I'm not sure how to get round the problem.
I can plot isosurfaces if r and theta are taken as the x and y axes but this doesn't represent the field properly (see below)
Any help would be much appreciated. Thanks, Nick.

Answers (0)

Community Treasure Hunt

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

Start Hunting!