Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Sierpinski triangle can be implemented in MATLAB by plotting points iterativ

ID: 3854082 • Letter: T

Question


The Sierpinski triangle can be implemented in MATLAB by plotting points iteratively according to one of the following three rules that are selected randomly with equal probability. Rule 1: x_n + 1 = 0.5x_n, y_n + 1 = 0.5y_n Rule 2: x_n + 1 = 0.5x_n + 0.25, y_n + 1 = 0.5y_n + (squareroot 3)/4 Rule 3: x_n + 1 = 0.5x_n + 0.5, y_n + 1 = 0.5y_n Write a program in a script file that calculates the x and y vectors and then plots y versus x as individual points (use plot (x, y, '^')). Start with x_1 = 0 and y_1 = 0. Run the program four times with 10, 100, 1,000, and 10,000, iterations.

Explanation / Answer

Variables

In Linux (Shell), there are two types of variable:

Comments

Quotes

Shell Built in Variables

Example 2
$cat > sname
vivek
ashish
zebra
babu
Press CTRL + D to save.
$ sort < sname > sorted_names
$ cat sorted_names

Example 3
$ tr "[a-z]" "[A-Z]" < sname > cap_names
$ cat cap_names

Example 4
$ sort > new_sorted_names < sname
$ cat new_sorted_names

Pipes

A pipe is a way to connect the output of one program to the input of another program without any temporary file.

Example
$ ls |
$ who | sort
$ who | sort > user_list
$ who | wc -l
$ ls -l | wc -l
$ who | grep chrys

Filter

If a Linux command accepts its input from the standard input and produces its output on standard output is know as a filter. A filter performs some kind of process on the input and gives output.
Example
Suppose you have file called 'hotel.txt' with 100 lines data, And from 'hotel.txt' you would like to print contains from line number 20 to line number 30 and store this result to file called 'hlist' then give command:
$ tail +20 < hotel.txt | head -n30 >hlist

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote