Solving an equation with two different variables of different ranges

1 visualización (últimos 30 días)
Hello All,
I am looking to solve the equation below with two different variables, phi and theta. However, those two variables are set for different ranges and the matrices sizes are different. Is there a way to get around this and solve for phi first, and then solve provide a results for every theta? Below I will provide the variables and their set ranges along with the equation to solve.
NS=4*2^(1-1);
h=(pi/2-0)/NS;
phi=0:h:pi/2;
theta = 0:2:90;
fphi = @ (phi) 1/sqrt(1-sin(theta/2).^2*sin(phi).^2) %This line may not be written properly as well as the next to account for theta as well. Again I would like to solve for phi, and then theta.
F = fphi(phi);
Any help would be much appreciated!
Thank you!

Respuesta aceptada

KSSV
KSSV el 27 de Feb. de 2017
NS=4*2^(1-1);
h=(pi/2-0)/NS;
Phi=0:h:pi/2;
Theta = 0:2:90;
[phi,theta] = meshgrid(Phi,Theta) ;
Fphi = @ (phi,theta) 1./sqrt(1-sin(theta/2).^2.*sin(phi).^2) ; %This line may not be written properly as well as the next to account for theta as well. Again I would like to solve for phi, and then theta.
F = Fphi(phi,theta);
% fphi = 1./(1-sin(theta/2).^2.*sin(phi).^2).^0.5 ;
surf(Phi,Theta,F)
  3 comentarios
Walter Roberson
Walter Roberson el 27 de Feb. de 2017
Plotting the result is not mandatory.
If you do want to plot and prefer a different style of plot, let us know what you were hoping for.
CAAJ
CAAJ el 2 de Mzo. de 2017
Thank you very much for your assistance, the function meshgrid worked as needed!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Mathematics 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