Borrar filtros
Borrar filtros

Conversion polar to Cartesian by interpolation

24 visualizaciones (últimos 30 días)
Paul
Paul el 2 de Jul. de 2015
Editada: Paul el 2 de Jul. de 2015
Hi every one
I have a strange error in my code
I have convert the data from Cartesian to the polar as bellow:
Error using interp2>makegriddedinterp (line 237)
Input grid is not a valid MESHGRID.
Error in interp2 (line 136)
F = makegriddedinterp(X, Y, V, method,extrap);
can any body solve this problem?
  1 comentario
Thorsten
Thorsten el 2 de Jul. de 2015
After you define u, what are you trying to achieve?

Iniciar sesión para comentar.

Respuestas (1)

Steven Lord
Steven Lord el 2 de Jul. de 2015
INTERP2 requires gridded data. The X and Y coordinate data you converted from polar is not gridded.
theta = (0:1/4:2)*pi;
rad = 0:5;
[T, R] = meshgrid(theta, rad);
[X, Y] = pol2cart(T, R);
Z = X.^2+Y.^2;
plot3(X, Y, Z, 'ko');
You may want to rotate that data to convince yourself that it's a bowl shape. To obtain the values of other points on the bowl, you will need to interpolate this using a tool that can interpolate scattered data:
[x2, y2] = meshgrid(-3:0.25:3);
S = scatteredInterpolant(X(:), Y(:), Z(:));
z2 = S(x2, y2);
hold on
plot3(x2, y2, z2, 'r+');
You should now see a "mesh" of + signs, like a piece of paper towel resting on the inner surface of the bowl.

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