Transmission coefficient calculation in Scilab gives reversed graph

2 replies · 3K views · last reply
Reshma
Messages
749
Reaction score
6
I seem to be getting some arbitrary values from my Scilab code for a function. I have to generate a graph showing the dependence of the transmission on the air gap separating two higher refractive index materials i.e. I want to plot "T" as a function of "d".
[tex]T = \frac{1}{1 + \beta \sinh^2 (\delta)}[/tex]
δ = 2∏d/λ

Code:
d = [0:0.01:1]
delta = 2*%pi*d
T = 1/(1+0.36*(sinh(delta))^2)
plot(d,T)
xtitle("Transmission dependence on d","d","T")

The output graph does not match with what I was expecting. The transmission T should start at 1 and decrease with increasing d. Instead the graph seems reversed. I have attached the output graph file. I plotted the graph with the same formula in excel and it turns out right. Can someone take a look at my code and point out where I am going wrong.

Thanks in advance.
 
Attachments
  • Line graph titled Transmission dependence on d, plotting T on the vertical axis (0 to 9e-006) against d on the horizontal axis (0.0 to 1.0); the curve stays near zero and rises steeply to about 8.5e-006 at d = 1.0.
    graph.jpg
    11.8 KB · Views: 570
I don't have Scilab but I think your problem is that T is calculated by matrix division not an element by element division. Other than that it seems like the code should work fine.

Try:
T = 1 ./(1+0.36 .*(sinh(delta)) .^2)
 
Wow, that worked (graph attached). Thanks a lot, Bob!
 
Attachments
  • Line graph titled 'Transmission dependence on d', plotting T against d from 0 to 1. T starts at 1.0 near d = 0, falls steeply between d = 0.1 and 0.4, and approaches 0 by about d = 0.6.
    FTR.jpg
    10.6 KB · Views: 603