Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Civil Engineering Expert

For this problem you will write a function that calculates avalue between zero and one for each element in a 512x512 matrix(yes thats 512x512). The call to the function will bebeetle(xmin,ymin,xmax,ymax). The element A(1,1)will use values xmin, ymin for calculations and the elementA(512,512) will use xmax, ymax for calculations. Intermediateelements will use evenly spaced values for x and y between xmin,ymin and xmax, ymax.

At each element location in the matrix you are to do thefollowing:

a. set an iteration counter, and twovariables r and s to zero.

b. Repeat the following whiler*r+s*s<=and number of iterations is less than 255

      i. Replace s withr*r-s*s+xi where xi is the value of x assoxciated witht the currentelement.

     ii. replace s with2*r*s+yi where yi is the value of y associated witht the currentelement. Note that the r used here must be the past value of rbefore it was changed in the previous step.

      iii. Increase the countervariable by 1.

c. Once you have exited the loop you willhave recorded the number of iterations required to haver^2+s^2>4 in the iteration counter. This will be a numberbetween 0 and 255. The number to be stored in the element A(i,j)will be 1-counter_valuee/255 so that the stored value is between 0and 1.

d. repeat the abouve for all elements in aremembering that each element will have a different x, ypair.   

To test your function call it with the following argumentsbeetle(-1.5,-1.0,0.5,1.0). You want to save the result but notprint it. To see if you have done a good job run the followingMATLAB commands on the saved matrix:

>>imagesec(A); colormap(gray); %assumes matrix stored inA

You should see an interesting figure window appear on thescreen and the name of the function may make more sense.

Note: I found that a good way to get the correct x and yvalues is to create an x vector of length 512 with values form xminto xmax using linespace. A y vector can be created in the samemanner.

Civil Engineering, Engineering

  • Category:- Civil Engineering
  • Reference No.:- M91067108

Have any Question?


Related Questions in Civil Engineering

Aimthis assignment aims to demonstrate the structural

Aim: This assignment aims to demonstrate the structural design requirements of a glazed façade in a multi-storey building. Among other requirements, the glazed façade is required to comply with Australian Standard AS 204 ...

Civilyou are provided with bill of quantities prepared

Civil You are provided with bill of quantities prepared separately, priced and submitted by 3 con- tractors (A,B,C found on LMS) in respect of a proposed project (see appendix for drawings). The site is located on Mt. Al ...

Masonry design assignmentquestion 1 - derivation of seismic

MASONRY DESIGN ASSIGNMENT Question 1 - Derivation of seismic actions on building a) Determine the storey seismic weights (Wi) for each suspended level of the building, hence the seismic weight (Wt) of the entire building ...

Task details the client is doing masters in civil

Task Details: The client is doing Masters in Civil Engineering. He needs a Technical Paper on Earthquake pertaining to Geology and Rock Mechanics. There should be a through discussion of Earthquake in relation to the men ...

Assessment taskpractical investigationinstructions- it is

Assessment Task Practical Investigation Instructions: - It is very important that you read these instructions. - The hardcopy of the Assignment report, with the Assignment cover sheet, should be submitted to the Assignme ...

1 aimthe assignment aims to develop the ability to analyse

1. Aim The assignment aims to develop the ability to analyse, evaluate, research plan and manage a major building project through individual and group participation (ideally 4-6 people).Refer to vUWS for the DA plans and ...

The drainage system of a cantilever wall shown in below

The drainage system of a cantilever wall shown in below figure, became blocked after a heavy rainstorm and the groundwater level, which was originallybelow the base, rose to1.5 (m) below the surface. Determine the stabil ...

Assignmenta continuous three spans beam with

Assignment A continuous three spans beam with centre-to-centre distance of 6 m supports 150 mm thick one-way slabs as shown below. The beams have clear spans of 8 m, 9 m, and 8 (face-to-face of 400 mm square columns). Th ...

Masonry design assignmentquestion 1 - derivation of seismic

MASONRY DESIGN ASSIGNMENT Question 1 - Derivation of seismic actions on building a) Determine the storey seismic weights (Wi) for each suspended level of the building, hence the seismic weight (Wt) of the entire building ...

Aimthis assignment aims to demonstrate the structural

Aim: This assignment aims to demonstrate the structural design requirements of a glazed façade in a multi-storey building. Among other requirements, the glazed façade is required to comply with Australian Standard AS 204 ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As