Find input to function 1 that results in function 2 returning 0
Show older comments
Hello,
I have a function that traces raypaths given input criteria. I then have a second function that solves for error at a given point in space. I am able to find the launch angles that would result in bracketing the target.
My question is this: having solved for launch angles that bracket the point, how do I find the launch angle that results in zero error? An excerpt of the code I am working with is below

rayangle = (-90:.1:90)
nray=length(rayangle)
for ii=1:nray
theta0=rayangle(ii)
z_r=raysolver(z0,theta0,cmat,nstep,rstep); %calling the function that traces the rays
z_r_theta0(ii,:)=z_r(1,:); %Saving the path of each ray in z_r_theta0
end
%% Finding error
%target co-ordinates
r=50000;
z=1100;
d_error=deptherror(r,z,z_r_theta0); %gives me depth error for each launch angle
bracket_ray=crossray(d_error)%this gives me all the launch angles that bracket the target.
%what I need is to find theta0 for each set of bracketing launch angles
%that result in d_error == 0
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB 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!