# i have to create a grid using meshgrid fn. and name it as grid_mat. i'm unable to name it and select points on it for different planets .

1 visualización (últimos 30 días)
Mohd irfan mahir el 12 de Sept. de 2021
Respondida: darova el 13 de Sept. de 2021
Create a grid using the function meshgrid (x, y), where x and y are coordinates of points in the solar system. Name this grid as grid_mat. By choosing the origin of the grid to be the Earth, specify the coordinates of Moon and Mars. Make sure that the Moon is between Earth and Mars. Assume the orbits of Moon and Mars to be circular.
% this is what i did
x = -8:8 ;
y = -8:8 ;
[X,Y] = meshgrid(x,y) ;
%Y = m.^2 - 4
a = b = 0;
grid_mat = sqrt((X-a).^2 + (Y-b).^2) ; %distance from any point a,b
Z = f(X,Y)
%G = 6.67428*10^(-11) ;
surf(X,Y,Z)
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Respuestas (1)

darova el 13 de Sept. de 2021
You can't assing variables that way
a = b = 0;
You can use deal
[a,b] = deal(0);
Or you can separately initiate variables
a = 0;
b = 0;
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Categorías

Más información sobre Earth and Planetary Science 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