# My plot is coming up empty. Can someone help me figure out why?

Posted 9 years ago
5724 Views
|
8 Replies
|
0 Total Likes
|
 Hi. I'm trying to get a plot, but although I think I'm doing everything correctly, the final plot comes up empty.The code I'm using is below. Can someone tell me what I'm doing wrong?p.s. Sorry about how the code looks. Copying the text from Mathematica seems to put it in this form. Subscript[n, i] = 1.0; \[Delta] = (4*\[Pi])/\[Lambda]*n*d*Cos[Subscript[\[Theta], 3] Degree]; Subscript[\[Theta], i] = ArcSin[n/Subscript[n, i]*Sin[Subscript[\[Theta], 3] Degree]]; Subscript[r, s] = ( Subscript[n, i]*Cos[Subscript[\[Theta], i] Degree] - n*Cos[Subscript[\[Theta], 3] Degree])/( Subscript[n, i]*Cos[Subscript[\[Theta], i] Degree] + n*Cos[Subscript[\[Theta], 3] Degree]); Subscript[r, p] = ( n*Cos[Subscript[\[Theta], i] Degree] - Subscript[n, i]*Cos[Subscript[\[Theta], 3] Degree])/( Subscript[n, i]*Cos[Subscript[\[Theta], i] Degree] + n*Cos[Subscript[\[Theta], 3] Degree]); Subscript[T, s] = (1 - Subscript[r, s])^2/1; Subscript[R, s] = (4*Subscript[r, s] Sin[\[Delta]/2]^2)/1; Subscript[T, p] = (1 - Subscript[r, p])^2/1; Subscript[R, p] = (4*Subscript[r, p] Sin[(\[Delta]/2) Degree]^2)/1; Manipulate[ Plot[{Subscript[T, s], Subscript[R, s]}, {Subscript[\[Theta], 3], -1, 1}, Frame -> True, PlotStyle -> {{Thickness[0.004], RGBColor[0, 0, 1]}, {Thickness[0.004], RGBColor[1, 0, 0]}}, PlotRange -> {{-1, 1}, {0, 1}}, PlotLegends -> {"T", "R"}], {{\[Lambda], 500*10^-9, "wavelength \[Lambda]"}, 350*10^-9, 750*10^-9}, {{d, 5*10^-6, "thickness d"}, (2*10^-6), (10*10^-6)}, {{n, 1.5, "refractive index n"}, 1.33, 1.8}] 
8 Replies
Sort By:
Posted 9 years ago
 However, I don't understand your comment about the difference with the Degree statement, because Rp and Rs seem to be identical in how the Degree statements are placed. Snipped from the original postin the previous appendix comm3977321.nb the missing (?) Degree was put into Rs in an attempt to get the pictures right ... but unfortunately with no success.
Posted 9 years ago
 Thank you for pointing out the plot range. I missed it because the lines are outside of where they should be.I checked the formulae, and as far as I can tell, they appear to be correct. However, I will try to get external confirmation.However, I don't understand your comment about the difference with the Degree statement, because Rp and Rs seem to be identical in how the Degree statements are placed.p.s. If I didn't state it before, thank you for trying to help me with this.
Posted 9 years ago
 It's the PlotRange! In my picture the blue line is above y = 1 and the red line is well below y = 0 and in your first picture it is again said PlotRange -> {{-1,1} (* right *), {0,1} (* too narrow for the formulae given ! *)}. Then please check the formulae, Rp has a Degree in it, the structural equal Rs does not have a degree. Something - which I didn't found - still prevents one to reach a physical meaningful picture (like the second one from your post), as seen from separat plots of Ts and Rs. Attachments:
Posted 9 years ago
 Udo, I tried it your way. I ended up with the same result:However, even with the plot you pulled up, it shouldn't be that flat. My understanding is that this is what it's supposed to look like:Regardless, I'm not even getting the flat lines. Is there an obvious mistake I'm making?
Posted 9 years ago
 You need to bring the variables inside Manipulate, forget about subscripted variables as function names, beauty trades off by no way the troubles coming in from itone might ask why the red and blue line a horizontal straight? That's because the variation is very small
Posted 9 years ago
 I'm not sure I follow. Do you mean in the cases where the degree symbol comes before the ArcSin argument? How can you tell that it's non-numeric? And how am I misusing it?
Posted 9 years ago
 No -- What I thought wasn't it. N[[Degree]] gives a numeric result.( It is the same as N[1 [Degree]]I'll look at it more later.
Posted 9 years ago
 I'm not sure but, by troubleshooting, I see the following: Table[{Subscript[T, s], Subscript[R, s]}, {Subscript[\[Theta], 3], -1, 1}] Notice how Degrees is being used in a non-numeric fashion in some cosine operations.