Message Boards Message Boards

0
|
6197 Views
|
8 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

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

Posted 10 years ago

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}]

POSTED BY: Charles Stanley
8 Replies
POSTED BY: Udo Krause
Posted 10 years ago
POSTED BY: Charles Stanley
Attachments:
POSTED BY: Udo Krause
Posted 10 years ago

Udo, I tried it your way. I ended up with the same result:

http://i.imgur.com/RGwrOES.png

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:

http://i.imgur.com/m1D37Ym.png

Regardless, I'm not even getting the flat lines. Is there an obvious mistake I'm making?

POSTED BY: Charles Stanley

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 it

Manipulate

one might ask why the red and blue line a horizontal straight? That's because the variation is very small

variation

POSTED BY: Udo Krause
Posted 10 years ago
POSTED BY: Charles Stanley

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 BY: Marvin Ray Burns
POSTED BY: Marvin Ray Burns
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract