Activity 3 – Scilab Basics

This activity was to build up our basics in SciLab. Scilab is easier to use than most programming platforms. I found it difficult to use scilab. Possibly because the documentation of Scilab is less definite than I’m used to with python.

The goals of this activity was to learn enough about scilab to create synthetic images.

In the activity sheet, this example of synthetic image is a circle:

circle

Scilab script for circle image. A mask r is used so that conditions upon r can be interpreted into A.

On the left is a higher res image(500×500 pixels). This was made by changing nx and ny along the image.

There was a set of challenges:

Centered Square Aperture

in order to do a centered square aperture. I changed the condition inside the find function. I set it so that every pixel that was a certain vertical distance away from the center was set to black.

Square

square

Major changes from example(condition for black changed to individual axes). I found out about ‘&’.

Annulus

The annulus was simple to do. A smaller circle did the trick.

Sinusoid

The sinusoid was a bit trickier. At first I thought that the image was supposed to look like a sin wave on the xy plane. But after consulting with classmates like Angelo Rillera, I found out that the image was supposed to look like a corrugated roof.  I did it by this:

sine

I defined an axis and set a grid the size of that axis. Then I just took the sin value over the whole grid.

Grating

At first I thought that we needed to make multiple rectangles and define each line. But I figured that you can make a square wave by making a pass filter. So I used the sine function image and included 2 conditions: anything negative is 0 and anything positive is 1.

Cross

The cross was easy. It was two rectangles.

Gaussian Aperture

The gaussian aperture was complicated. It the mask r was needed for the circular ring but the gaussian transparency had to be done on A(took me multiple trial-and-errors to find that out).

 

About Nestor

One day, I thought, hey, I'll be writer. Turned out that writing isn't exactly a science. Now I'm a physics major wasting time trying to write
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a comment