Solving an equation with two different variables of different ranges
14 views (last 30 days)
Show older comments
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!
0 Comments
Accepted Answer
KSSV
on 27 Feb 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 Comments
Walter Roberson
on 27 Feb 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.
More Answers (0)
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!