Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5.3) MATLAB Exercises 1. Extend the factorial function dened above, such that it checks for a positive input argument. 2. Write a function that calculates

5.3) MATLAB Exercises 1. Extend the factorial function dened above, such that it checks for a positive input argument. 2. Write a function that calculates a random walk trajectory based on the iteration xi+1 = xi + , where is a uniformly distributed random variable between -1 and 1. Plot the resulting trajectory. 3. Change the sorting algorithm given above such that it sorts the elements in descending order. Compare the speed of your function with the built-in MATLAB function sort. 4. Approximation of . The area of a circle is given by A = r2 where r is the radius. Assume a circle with r = 0.5 embedded in a unit square. A point in the unit square is dened by p = (x,y) where 0 x,y 1. If we draw ntot times two uniformly distributed random numbers (x,y) and count how often the corresponding points falls into the circle (ncirc), we get an approximation of the circle area by ncirc ntot and by that of the number . Write a function which approximates by the described method. How many draws do you need to get the rst three digits right?

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_2

Step: 3

blur-text-image_3

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

International Baccalaureate Computer Science HL And SL Option A Databases Part I Basic Concepts

Authors: H Sarah Shakibi PhD

1st Edition

1542457084, 978-1542457088

More Books

Students also viewed these Databases questions

Question

Explain control of the basic rhythm of breathing.

Answered: 1 week ago

Question

Describe the patterns of business communication.

Answered: 1 week ago

Question

3. Provide two explanations for the effects of mass media

Answered: 1 week ago