Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Simplefern function : In the Moodle for this assignment, you will write a scripts called ferntree.m. You should use the function, simplefernm to help you.

image text in transcribed

Simplefern function :

image text in transcribed

In the Moodle for this assignment, you will write a scripts called ferntree.m. You should use the function, simplefernm to help you. Its calling syntax is >xs-simplefern (n) . where the input argument n is the number of desired points in the fern, and the output argument xs is the 2n matrix of the x-y-coordinates of those points. Your job is to generate a fern with simplefern containing 10000 points. Then you are find the base of the fern stem and to translate it to the origin. Then, you are to make multiple copies of the fern, each rotated by 45 degrees so that the final image looks like this: 1. To translate the base to the origin (0,0). you might find the min function to be useful >>doc min). First you determine where the base is. That is your offset. The x-offset and the y-offset will be different. Thus, you will want to translate the x-coordinates and the y-coordinates different amounts. But xs is a 2xn matrix. To address just the x-coordinates you will want to add or subtract your offset to xs (1,:) for just the x-coordinates. The colon as a subscript or index means all. Thus, xs (, means first row and all of the columns. Can you guess the syntax for the y-coordinates? 2. To rotate the copies of the fern, you will need to construct a rotation matrix and apply it to xs You will want to use a FOR-LOOP 3. To concatenate the copies you will want to use the cat command (>doc cat) >> help cat cat Concatenate arrays cat (DIM,A,B) concatenates the arrays A and B along the dimension DIM Since xs is a 2n matrix, you will want to concatenate the rnatrices along the 2nd dimension. In other words, you will want more columns NOT more rows. 4. To plot the ferntree, you will need to use a modified version of the plot command in the finitefern.m code. In the Moodle for this assignment, you will write a scripts called ferntree.m. You should use the function, simplefernm to help you. Its calling syntax is >xs-simplefern (n) . where the input argument n is the number of desired points in the fern, and the output argument xs is the 2n matrix of the x-y-coordinates of those points. Your job is to generate a fern with simplefern containing 10000 points. Then you are find the base of the fern stem and to translate it to the origin. Then, you are to make multiple copies of the fern, each rotated by 45 degrees so that the final image looks like this: 1. To translate the base to the origin (0,0). you might find the min function to be useful >>doc min). First you determine where the base is. That is your offset. The x-offset and the y-offset will be different. Thus, you will want to translate the x-coordinates and the y-coordinates different amounts. But xs is a 2xn matrix. To address just the x-coordinates you will want to add or subtract your offset to xs (1,:) for just the x-coordinates. The colon as a subscript or index means all. Thus, xs (, means first row and all of the columns. Can you guess the syntax for the y-coordinates? 2. To rotate the copies of the fern, you will need to construct a rotation matrix and apply it to xs You will want to use a FOR-LOOP 3. To concatenate the copies you will want to use the cat command (>doc cat) >> help cat cat Concatenate arrays cat (DIM,A,B) concatenates the arrays A and B along the dimension DIM Since xs is a 2n matrix, you will want to concatenate the rnatrices along the 2nd dimension. In other words, you will want more columns NOT more rows. 4. To plot the ferntree, you will need to use a modified version of the plot command in the finitefern.m code

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Watson Watson

5th Edition

0471715360, 978-0471715368

Students also viewed these Databases questions

Question

5. Save raster im?

Answered: 1 week ago

Question

=+ d. a professor deciding how much to prepare for class

Answered: 1 week ago