Jump to content
UltravioletPhotography

Diabatic plots in MATLAB


Andy Perrin

Recommended Posts

I wrote a plotting routine for making the diabatic-style plots in MATLAB awhile ago. Ulf was asking for it, and I don't mind releasing it into the wild, although if you use it, please credit me somewhere!

 

Example plot:

post-94-0-51136900-1502812608.jpg

 

Syntax: It's the same as the MATLAB plot command, and it should accept Property/Value pairs and LineSpecs the same way. The restrictions are that the y-coordinate must have y between 0 and 1, not including either, for obvious mathematical reasons.

 

The diabatic transformation is:

y_diabatic = 1-log(log(1/y_linear))

where the logs are base 10.

 

Example syntax:

In the following, lambda is a vector of wavelength values, transmittance_BG39UG11 is a vector of BG39/UG11 stack transmittances value (expressed as decimals between 0 and 1), and transmittance_S8612UG11 is a vector of S8612/UG11 stack transmittance values expressed the same way.

figure
minLambda = 240;
maxLambda = 1100;
maxT = 0.85;
minT = 1e-11;
d_BG39UG11 = [2.5, 2.0]*1e-3; %m
d_S8612UG11 = [1.5, 2.0]*1e-3; %m

%[stack transmittance calculations were here, but I removed them from this example code...]

diabatic(lambda, transmittance_BG39UG11, 'r--',...
   lambda, transmittance_S8612UG11, 'b--','LineWidth', 1);

axis([minLambda, maxLambda, 1-log10(log10(1./1e-8)), 1-log10(log10(1./0.8))]);
legend(sprintf('Transmittance %1.3g mm BG39/ %1.3g mm UG11',d_BG39UG11(1)*1000, d_BG39UG11(2)*1000),...
       sprintf('Transmittance %1.3g mm S8612/ %1.3g mm UG11',d_S8612UG11(1)*1000, d_S8612UG11(2)*1000));
xlabel('Wavelength (nm)');
ylabel('Transmittance');
title('Transmittance (diabatic scale)');

 

The code is at my dropbox (and if the link dies, just shoot me a message):

https://dl.dropboxus...4858/diabatic.m

Link to comment

Nice program, Andy!

 

Are we calculating Transmittance here or Transmission? Please clarify. Thanks.

 

Also, in MatLab, what does a vector look like? Comma separated or what? Thanks.

 

[No, I don't know MatLab. Wish I did though.]

 

Totally off topic question: what does one of these graphs look like if the natural ln (base e) is used instead?

Link to comment

Andrea, we aren't calculating anything, really, this is just a routine for PLOTTING diabatic graphs! The data is just example data and is incidental. For the example shown, it's technically the fraction of light transmitted through the whole stack, which is the "transmission," while the "transmittances" are the fractions that make it through each individual surface of the filters. I tend to be careless about that distinction, however.

--

In MATLAB, you put in a vector like this. Commas are optional in MATLAB.

lambda = [300, 310, 320, 330];

 

A vector in MATLAB is the essentially same as an array in any other language but they can also represent mathematical vectors (in the linear algebra sense). If you have equally spaced points, a faster syntax is:

lambda = linspace(300, 330, 4);

--

If you use base e, it would look similar except instead of reading powers of ten along the axis, it would be powers of e, like "e1 e2 e3 ..." because all logs are proportional to each other!

Link to comment

Yep, Nice to see diabatic graph in MATLAB. Cool Andy! :-)

Just a side not, to truly compare the difference between a stack using S8612 with the same stack using BG39, you should use the same thickness in the formula.

Those two glass types are truelove the same other than the S8612 transmits deeper UV.

Link to comment

Yep, Nice to see diabatic graph in MATLAB. Cool Andy! :-)

Just a side not, to truly compare the difference between a stack using S8612 with the same stack using BG39, you should use the same thickness in the formula.

Those two glass types are truelove the same other than the S8612 transmits deeper UV.

Oh, it wasn't meant to be a head-to-head comparison of the stacks as if they were equivalent. At the time I made that, it was before we realized my "S8612" was in fact the Chinese stuff, and I was trying to compare the two stacks I actually OWNED (or thought I did...) on theoretical grounds.

Link to comment

Yes, I understand, just pointing that out if anyone was comparing BG39 with S8612. BG39 is not really of any use if you can use S8612 instead, basically EVER, just want people to understand that.

I son't think anyone makes any filter glass that is equivalent to Schott's S8612.

I really like your diabatic graph!

 

Here is direct 2mm vs 2mm comparison of BG38 with S8612, etc..

post-87-0-13892100-1502915672.jpg

Link to comment

Andy, thanks for the clarifications !! I coded for years, but never needed or got to use Matlab. My coding was more pure C/C++/Unix type stuff. Also some Java and various shell scripts in ksh/Perl/awk. A math prof friend always spoke highly of Matlab. My SigOth might even have a copy, I should ask him.

 

Silly me about the log base 10 versus ln plotting. Of course they'd look similar. It has been waaaaay too long since I ever dealt with graphs. Since teaching calculus at UC-Davis back in 1984 in fact!!!! A couple of years ago when Cadmium started showing us the Schott graphs, I worked out why the transformation "distorts" the graph the way it does. Very instructive.

 

I wonder what it is like teaching calculus these days when students have access to so many nifty programs and devices for seeing how functions behave? We could ban calculators from the classroom and tests back then. Prolly could not do that now. And I agree. Best teach with such things than without them, yes?

Link to comment
Since I tutor calculus (among other subjects) and I was in the first generation to learn it with graphing calculator at hand, I have to agree! (Side note: Texas Instruments have been making the same calculators for 20 years now since I was in high school, and charging the SAME AMOUNT, but the technology must cost a fraction of what it did at that time, so they are really stiffing today's students! Nice to have a captive audience.)
Link to comment

You tutor calculus! What textbooks are being used these days that take into account the tools we now have available? I would love to get a copy of one -- on the used market, of course, given the high price of textbooks these days.

 

I remember having to teach the students how to draw a 3-dim parabolic saddle surface by first providing them with a horse figure. :rolleyes: :rolleyes: :rolleyes:

Link to comment
I think most of them take at least glancing notice of graphing calculators, but if I were you, I'd save your cash. The books don't do all that great a job of making use of the tech. Typically the actual text does not mention the calculator at all, and then they have a problem section that asks you to graph them (or make use of the calculator to get roots or whatever). The ability to graph in polar is pretty nice, though, because those plots tend to be harder to visualize from the equation.
Link to comment

So there might be an opportunity for some enterprising calculus book author to beef up the approach. (Not me, for sure!!!)

 

I'm disappointed to hear that there aren't any good exercises combining theory and tech. Or any exercises for solving 'real world' modeling problems with calculus + tech tools. Oh well. Some other century perhaps.

Link to comment
Oh, well, they try to do the modeling thing a bit, but students just learning calculus don't really know enough math yet to really model something interesting. You need some differential equations and linear algebra to really have the tools to do the cool stuff. They give enough to get a bit of the flavor of it, but not enough to be really satisfying to anyone interested.
Link to comment

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...