Mathematica Plotting Binocular Disparity in Mathematica - Solve for f & d

  • Thread starter Thread starter SoggyBottoms
  • Start date Start date
  • Tags Tags
    Mathematica Plot
AI Thread Summary
The discussion centers on calculating binocular disparity using a specific formula and parameters. The formula for disparity, δ, is given as a function of variables f and d, with assigned values for a, D, and e. The task involves plotting the disparity for f ranging from e - 10 to e + 10 and d from -20 to 20. A participant shares their approach to defining the function mydisparity and successfully creates a 3D plot using Plot3D in their programming environment. The conversation highlights the importance of avoiding capitalized variable names to prevent conflicts with built-in functions. The participant expresses satisfaction upon successfully generating the plot.
SoggyBottoms
Messages
53
Reaction score
0
I calculated a binocular disparity \delta of two points, see also this topic, and got the following formula:

\delta = Arctan(\frac{f}{D + d}) - Arctan(\frac{e}{D}) - Arctan(\frac{a - e}{D}) + Arctan(\frac{a - f}{D + d})

The assignment now says: Choose a = 6.5 cm, D = 40 cm and e = 3.25 cm. Plot the disparity for f \in [e - 10, e + 10] (cm) and d \in [-20, 20] (cm).

Does anyone know how I could make such a plot?
 
Physics news on Phys.org
That's just a function of 2 variables ok, Note I do not use user-defined variable names that begin with capital letters as this may conflict with built-in functions:

Code:
a = 6.5; 
bigD = 40; 
e = 3.25;
 
mydisparity[f_, d_] := ArcTan[f/(bigD + d)] - 
   ArcTan[(a - e)/bigD] + ArcTan[(a - f)/(bigD - d)]
mydisparity[2, 3]

Plot3D[mydisparity[f, d], {f, e - 10, e + 10}, 
  {d, -20, 20}]
 
Thanks! I got it to work.
 
Last edited:

Similar threads

Replies
2
Views
2K
Replies
19
Views
2K
Replies
4
Views
3K
Replies
4
Views
3K
Replies
4
Views
5K
Replies
3
Views
2K
Replies
5
Views
1K
Replies
10
Views
946
Back
Top