Tuesday, June 21, 2011

two

Last week, the manual for our Scilab Basics activity had been given to us together with our Digital Scanning activity.  As things were - first week of school and all - I had much time to spare and so I was able to work on the activity before the time to formally start it came.  Appropriately titled, the activity introduced us to Scilab and if you are a person who's previously used MATLAB, Scilab isn't really that hard to navigate.  Installing it, of course, is another matter.

From my Applied Physics 185 class last semester, I had Scilab 5.3.0 installed on my computer.  I downloaded the appropriate SIVP Toolbox but it didn't work.  Sigh.  I decided then to use Scilab 4.1.2 along with the SIP toolbox.  At first, SIP and Scilab just didn't mesh with each other.  Sigh.  But, with the help of Ma'am Jing's blog post (see it here), I was able to use SIP (finally!).  I actually have to give the most credit to a comment on the same post.  Upon following the instructions there, I could simply click on siptoolbox under Scilab's toolboxes tab to make use of it - no more unnecessary typing on the console!  Of course, that does not excuse me from the few moments of age catching up with me - moments that would result to ultimate panic because my code wasn't working.  What did I do then?  Well, of course, I just forgot to click on siptoolbox under the toolboxes tab!

From there on (excluding the panic attacks), I breezed through the different matrix operations - addition, subtraction, matrix and element per element multiplication - just so I could get a feel of how Scilab really is.  Like I said previously, not that much different from MATLAB.

Included in the manual was a code that, when implemented would generate a centered circle that could be used  to simulate a circular aperture or a pinhole.  Because this isn't a W***P**** (must ... stay ... loyal) blog, I can't actually upload the code itself.  Hence, I provide you a screenshot of my code and the image it generated.

Figure 1. (top) Image of generated Centered Circle Aperture using (bottom) Scilab 4.1.2 Code

Unlike the previous results, the ones that follow were generated using codes written by yours truly.  The first was a square aperture.  In truth, I somewhat recycled the code for the circular aperture here, with a few lines modified of course to be able to generate a square instead of a circle.

 Figure 2. (top) Image of generated Square Aperture using (bottom) a Scilab 4.1.2 Code

Generating the next two results proved to be quite interesting to me as they look very similar in appearance.  Similar, but not the same.  The sinusoid along the x-axis, obviously has "gray" areas as I might call them due to, well, it's being a sinusoid.  Gratings, as I have come to know do not possess "gray" areas because they have sharp edges.  Needless to say, the "gray" areas depict the decreasing or increasing values of the sinusoid.   Another way of putting it would be that the sinusoid looks much like how a tin roof would if viewed from above and the grating like prisoner's uniforms.  But instead of boggling your mind with the strange mental pictures I associate with the images I was able to create, let me just show them to you with the codes that go with them.

 Figure 3. (top) Image of generated Sinusoid along the x-direction using (bottom) a Scilab 4.1.2 Code

 Figure 4. (top) Image of generated Grating along the x-direction using (bottom) a Scilab 4.1.2 Code

I have to admit, I had to run to Google for the next task.  I don't think I've ever heard of the word "annulus" until now.  Of course, I might have forgotten it since I never was one to hold onto the technical terms of things.  Anyway, generating the annulus was fairly simple involving only the combination of two circular apertures forming what looks like a donut or a ring - depending on if you're into food or jewelry.  

  Figure 5. (top) Image of generated Annulus using (bottom) a Scilab 4.1.2 Code

The final task was what gave me hell.  Up until this morning, I was confused on what a "Circular Aperture with Graded (or Gaussian) Transparency".  Not until we had our Physics 166 class right before our Applied Physics 186 class did I realize that it meant I would have to "multiply" a Gaussian Filter and a circular aperture (credits to Dr. Wilson O. Garcia for that).  I came up with the results below:

  Figure 5. (top) Image of a generated Circular Aperture with a Graded or Gaussian Transparency 
using (top) a Scilab 4.1.2 Code

All the snippets of code that I've placed here show the numerical values used to generate the above figures I've shown.  You could probably tweak the numbers a bit to show the different results that can be yielded - of course, you'd have to type it so good luck to you on that. *evil smirk*

This is going to sound bad but I wasn't really able to do more than the assigned tasks because it slipped my mind that I had the option of doing so.  So many senior moments for this activity!  I feel like I do have to reward myself for completing the task before the class even began and for that, I give myself a perfect 10.

NOTE TO SELF: Don't just do what needs to be done.  Do what can be done to make your work a step beyond amazing.

No comments:

Post a Comment