Mathematica Asked by PP804 on February 17, 2021
I wanted to plot the function:
TheoreticalT[n2_, k2_, w_] := (2*cn2[n2, k2]*(n1 + n3)*E^i(2*Pi*w*d2 (cn2[n2, k2] - 1))/c))/
((n1 + cn2[n2, k2])*(n3 + cn2[n2, k2]) - (cn2[n2, k2] - n1)*(cn2[n2, k2] - n3)*
e^(i(2*cn2[n2, k2]*2*Pi*w*d2)/c));
with n2 and k2 defined from:
cn2[n2_, k2_] := n2 - ik2;
and all the other variables being constants (n1, n3, d2, c):
n1 = 1 + i0; (*complex index of refraction of air*)
n3 = 1.7862 + I 0; (*complex index of refraction of substrate*)
d2 = 2.9477*10^-5; (*thickness of the sample(mm)*)
c = 0.29979;(*speed of light:mm/ps*)
I have tried doing a simple plot of just the n2 variable:
Plot[TheoreticalT[n2_, w_], {w, 0, 3}, Evaluated -> True]
But I’m not seeing any plot:
[![enter image description here][1]][1]
Any suggestions on how to proceed? Thank you
[1]: https://i.stack.imgur.com/m9wXI.png
The Reason is that you try to plot a function Mathematica does not know: TheoreticalT
takes in 3 input values not two. Also the syntax is different, see below. Also you have not set all variables in your provided code the following parameters are free:
ik2, i0, e , i, n2
I think you want to change e->E and i->I. Notice Mathematica Notebook shows unknown variables in blue. You further want to change:
Plot[TheoreticalT[n2_, w_], {w, 0, 3}, Evaluated -> True]
into:
Plot[{Re@TheoreticalT[n2, k2, w], Im@TheoreticalT[n2, k2, w]}, {w, 0, 3}]
Which means you need to set k2 as well.
Correct answer by Mr Puh on February 17, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP