Wednesday, August 20, 2014

AP 186 Activity 3 Scilab Basics

In this activity, we explore Scilab and how it can be used to make synthetic images. For practice, an example code for a circular aperture was given and it was run into Scinotes. The resulting image is shown in Figure 2.

Figure 1. Example Scinotes code that makes a circular aperture.
Figure 2. Output image of the example code that makes a circular aperture.

           The code was then examined carefully so that we can to create the following synthetic images.
     A) Centered square aperture
            For this I had to search the internet for the equation of a square. At first my code was a centered diamond aperture but a few adjustments to the code and I got a square! 
Figure 3. Code that makes the centered square aperture.
Figure 4. Output image from the centered square aperture code.
     B) Sinusoid along the x-direction (corrugated roof)  
            As the name suggests, it needs a sine function. I wanted to see more of the roof so I chose 8*%pi as my values to be put into the sine function.    
           
Figure 5. Code that makes a corrugated roof.
Figure 6. Output image from the corrugated roof code.

     C) Grating along the x-direction
             This should look like the corrugated roof but more sharp. It took me a while to figure it out.
Figure 7. Code that makes a grating along x-direction. 
Figure 8. Output image from grating along x -direction code.
     D) Annulus
             I assumed that this is just like a circle. I just need to figure out how to hollow it out and the code will show you how I solved it.
Figure 9. Code that makes an annulus.
Figure 10. Output image from annulus code.
      E) Circular aperture with graded transparency (Gaussian transparency).
                 This is one of the trickiest images. I had to search what a Gaussian transparency is.

Figure 11. Code that makes a circular aperture with graded transparency.
Figure 12. Output image from circular aperture with graded transparency code.
     F) Ellipse
             I figured out that this is just like a circle but it should be like an annulus with a hollow center.
Figure 13. Code that makes an ellipse. 
Figure 14. Output image of ellipse code.

     G) Cross
                I wanted to make this cross thicker in the vertical axis than the horizontal.

Figure 15. Code that makes a cross.
Figure 16. Output image of the code that makes a cross.
Explorations:
        I added two synthetic images, I combined the code for the cross and of the ellipse. I didn't expect to get this image. I thought that I will get an ellipse with a cross underneath. This was a really fun way to learn about making synthetic images using Scilab.
Figure 17. Code that was combined. Made using code from cross and ellipse.

Figure 18. Output image of the code from Figure 17.

         If I would rate myself I will give a 10 since I did all the required synthetic images and the exploration part.


Sources:
[1] M. Soriano, A3 - Scilab Basics 2014(PDF File). 2014
[2] Polymathprogrammer.com, Can you describe a square with 1 equation? Retrieved from: http://polymathprogrammer.com/2010/03/01/answered-can-you-describe-a-square-with-1-equation/

No comments:

Post a Comment