Fig 1. Circle
The goal of this activity is to master manipulating matrices in Scilab. I think.The task is to create different types of images using basic matrix operations.
Given here first is a circle as provided by the initial code.
Next up is a square which is done by taking the intersection of two white strips, one vertical and one horizontal.
Fig 2. Square and Cross
If instead of an intersection, we take the union, then we get a cross.
Fig 3. Sinusoidal and Grating
The shortest codes I've written are for the periodic figures. These are much easier because no matrix operations are actually performed. The matrices are done just about as they are initialized. ez.
Fig 4. Annulus and Ellipse
A little bit longer but far easier to code are the circle derivatives. The annulus is just a black circle inside a white circle. How hard could that be? And the ellipse uses exactly the same code as the circle except we put different dividers on the X and Y matrices.
Finally the gaussian transparency which made me to learn how to define a function in scilab. Yeahp totally forgot to check if a gaussian function already exists (which probably does... in all languages).
I basically just set each matrix element value based on the gaussian function with respect to distance from the center. Then I blacked out everything outside some radius r.
I basically just set each matrix element value based on the gaussian function with respect to distance from the center. Then I blacked out everything outside some radius r.
Fig 5. Gaussian filter
I've been staring at this for about 3 hours and I still have no idea how functions actually work in Scilab. I was not able to do any combination pattern because I keep getting an error about about redefining functions and nooooo I'm not gonna brute force my matrices.
It took me around 30 minutes to do the basic figures and 3 hours to do absolutely nothing. Scilab is really frustrating right now. I remember how when I first looked at the activity I thought "I can do this in 10-15 minutes" but NOPE. More frustrating is that I can't seem to find proper/complete documentation of even basic stuff. Not even in stackoverflow can I find answers to simple questions. Or maybe I'm too stupid that my questions shouldn't even be asked. I hope not.
Gawd I can probably do all this in Python in 10 minutes. Scilab is looking like Matlabs retarded brother whom no one really pays attention to.
No comments:
Post a Comment