For a cylindrical container, the shape of standing waves (like the waves that might form on...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
For a cylindrical container, the shape of standing waves (like the waves that might form on the surface of your tea in a loud cafe) is described using a special function called 'Bessel's function of the first kind of order zero', which is denoted Jo(x). The locations of the peaks and valleys of these surface waves (the extrema) are often important in applications and can be found where the slope of Jo(x) is zero-just like finding any extrema of a function. Luckily, it is known that dJo(x) =-J(x), where J(x) is Bessel's function of the first kind of order one. dx Write a script to find the location of the first N extrema for surface waves in a cylindrical container using Bessel functions and the MATLAB function fzero. Your script should do the following: 1. Use the MATLAB function besselj (n,x) to create an anonymous function, bessel0, corresponding to Jo(x). (Hint: You can treat the 'x' input to besselj just like any other 'x' you would use when defining an anonymous function.) 2. In a similar manner, create the anonymous function bessel1 corresponding to Ji(x). 3. Use fzero to find the first N extrema (for x 20) of the surface waves (i.e., the extrema of Jo(x)) to a relative accuracy of 1e-8. An optimization options variable (options) containing the tolerance setting has already been created for you. It should be supplied to fzero as the last input argument after the function handle and the estimate of the root location/interval.* Recall that fzero requires an initial guess for the location of the zero. Since you are likely not very familiar with Bessel functions, I encourage you to plot these functions so that you have a better visual interpretation of this extrema-finding task. I have provided some code at the end of your template to help you do this. Please read the comments carefully. 4. The fzero function can only find one zero at a time, which means you will have to iterate through initial guesses for the locations of the zeros until you find all N zeros. Implement this iterative scheme using at least 1 form of looping structure. (Hints: I used nested loops to solve this problem. I also used the fact that the first zero always occurs at x = 0 to define the first entries of r outside my looping structure. This effectively gave my algorithm a starting place. I have included this bit of code in your template, as well. Feel free to use it or not-your code need not look exactly like mine, so long as you solve the problem!) 5. Store both the locations of the extrema (i.e., the x values where the extrema occur) and the corresponding values of Jo in ascending order in the Nx2 matrix r. Code has been provided for you to plot Jo(x) along with the extrema you find. You can use this code to help you visualize the problem. Comment out any lines you don't want to run while debugging your solution. *Note: Solver options such as the numerical tolerance on the function values or root location can be provided as an additional input to fzero. The options should be stored in an options variable created by the optimset function. See the fzero and optimset documentation for more information and examples. 1 N = 1 + randi (15); % define number of zeros to be found, [116] 2 r = zeros (N, 2); % preallocate r vector 3 4 % Define the function handles. 5 bessel0 = 6 bessel1 = 7 8 % Set the arguments for FZERO. 9 options = optimset('Display','none', 'Tolx', le-8); 10 11 % The first zero is at x = 0, so run fzero with a guess of x = 0, which will just return 0. 12 % Store the location of the zero to r(1,1) and the value of J0 at this root to r(1,2). 13 % This operation is performed outside the loop to provide a starting location for the algorithm. 14 15 r(1,1)= fzero(bessel1,0, options); 16 r(1,2) bessel0 (r(1,1)); 17 = 18 % Develop iterative scheme for finding zeros 2:N of J 19 20 %%%%% Plot the function and the extrema %%%%%% 21 % Using this part of the script is completely optional, but I recommend using it to 22 % help visualize the problem. 23 % Define the x values. 24 % x = 0:0.1:30; % use this range when you are trying to get a sense of the problem 25 % %x = 0:0.1:r(N,1); % use this range when you want to see all your zeros 26 % % make figure 27 % figure; hold on; grid on; 28 % plot (x, bessel0 (x), 'k') 29 % plot (x, bessel1(x), 'Color', [0.6350 0.0780 0.1840]) 30 % plot (r(:,1),r(:,2), 'o', 'Color', [0 0.4470 0.7410]) 31 % plot (r(:,1),0*r(:,1), 'x', 'Color', [0.4660 0.6740 0.1880]) 32 % axis ( [0 max(x) -1 1]); 33 % legend('Bessel J of Order Zero', 'Bessel J of Order One', 'Extrema of Order Zero', 'Zeros of Order One') 34 For a cylindrical container, the shape of standing waves (like the waves that might form on the surface of your tea in a loud cafe) is described using a special function called 'Bessel's function of the first kind of order zero', which is denoted Jo(x). The locations of the peaks and valleys of these surface waves (the extrema) are often important in applications and can be found where the slope of Jo(x) is zero-just like finding any extrema of a function. Luckily, it is known that dJo(x) =-J(x), where J(x) is Bessel's function of the first kind of order one. dx Write a script to find the location of the first N extrema for surface waves in a cylindrical container using Bessel functions and the MATLAB function fzero. Your script should do the following: 1. Use the MATLAB function besselj (n,x) to create an anonymous function, bessel0, corresponding to Jo(x). (Hint: You can treat the 'x' input to besselj just like any other 'x' you would use when defining an anonymous function.) 2. In a similar manner, create the anonymous function bessel1 corresponding to Ji(x). 3. Use fzero to find the first N extrema (for x 20) of the surface waves (i.e., the extrema of Jo(x)) to a relative accuracy of 1e-8. An optimization options variable (options) containing the tolerance setting has already been created for you. It should be supplied to fzero as the last input argument after the function handle and the estimate of the root location/interval.* Recall that fzero requires an initial guess for the location of the zero. Since you are likely not very familiar with Bessel functions, I encourage you to plot these functions so that you have a better visual interpretation of this extrema-finding task. I have provided some code at the end of your template to help you do this. Please read the comments carefully. 4. The fzero function can only find one zero at a time, which means you will have to iterate through initial guesses for the locations of the zeros until you find all N zeros. Implement this iterative scheme using at least 1 form of looping structure. (Hints: I used nested loops to solve this problem. I also used the fact that the first zero always occurs at x = 0 to define the first entries of r outside my looping structure. This effectively gave my algorithm a starting place. I have included this bit of code in your template, as well. Feel free to use it or not-your code need not look exactly like mine, so long as you solve the problem!) 5. Store both the locations of the extrema (i.e., the x values where the extrema occur) and the corresponding values of Jo in ascending order in the Nx2 matrix r. Code has been provided for you to plot Jo(x) along with the extrema you find. You can use this code to help you visualize the problem. Comment out any lines you don't want to run while debugging your solution. *Note: Solver options such as the numerical tolerance on the function values or root location can be provided as an additional input to fzero. The options should be stored in an options variable created by the optimset function. See the fzero and optimset documentation for more information and examples. 1 N = 1 + randi (15); % define number of zeros to be found, [116] 2 r = zeros (N, 2); % preallocate r vector 3 4 % Define the function handles. 5 bessel0 = 6 bessel1 = 7 8 % Set the arguments for FZERO. 9 options = optimset('Display','none', 'Tolx', le-8); 10 11 % The first zero is at x = 0, so run fzero with a guess of x = 0, which will just return 0. 12 % Store the location of the zero to r(1,1) and the value of J0 at this root to r(1,2). 13 % This operation is performed outside the loop to provide a starting location for the algorithm. 14 15 r(1,1)= fzero(bessel1,0, options); 16 r(1,2) bessel0 (r(1,1)); 17 = 18 % Develop iterative scheme for finding zeros 2:N of J 19 20 %%%%% Plot the function and the extrema %%%%%% 21 % Using this part of the script is completely optional, but I recommend using it to 22 % help visualize the problem. 23 % Define the x values. 24 % x = 0:0.1:30; % use this range when you are trying to get a sense of the problem 25 % %x = 0:0.1:r(N,1); % use this range when you want to see all your zeros 26 % % make figure 27 % figure; hold on; grid on; 28 % plot (x, bessel0 (x), 'k') 29 % plot (x, bessel1(x), 'Color', [0.6350 0.0780 0.1840]) 30 % plot (r(:,1),r(:,2), 'o', 'Color', [0 0.4470 0.7410]) 31 % plot (r(:,1),0*r(:,1), 'x', 'Color', [0.4660 0.6740 0.1880]) 32 % axis ( [0 max(x) -1 1]); 33 % legend('Bessel J of Order Zero', 'Bessel J of Order One', 'Extrema of Order Zero', 'Zeros of Order One') 34
Expert Answer:
Related Book For
Applied Regression Analysis and Other Multivariable Methods
ISBN: 978-1285051086
5th edition
Authors: David G. Kleinbaum, Lawrence L. Kupper, Azhar Nizam, Eli S. Rosenberg
Posted Date:
Students also viewed these mechanical engineering questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
QUIZ... Let D be a poset and let f : D D be a monotone function. (i) Give the definition of the least pre-fixed point, fix (f), of f. Show that fix (f) is a fixed point of f. [5 marks] (ii) Show that...
-
IKEA was founded in 1943 by a 17-year-old Swede named Ingvar Kamprad. The company, which initially sold pens, Christmas cards, and seeds from a shed on Kamprad?s family farm, eventually grew into a...
-
Out performance certificates (also called "sprint certificates", "accelerator certificates", or "speeders") are offered to investors by many European banks as a way of investing in a company's stock....
-
The following purchase transactions occurred during December for Rehoboth Inc.: Dec. 6. Purchased office supplies for $415, on account from Supply Hut Inc. 14. Purchased office equipment for $1,950,...
-
Jack L. Hargrove is president and majority shareholder of Jack L. Hargrove Builders, Inc. (Hargrove). Gerald A. Heinz is president and majority shareholder of Gerill Corporation. After engaging in a...
-
The Kollar Company has a defined benefit pension plan. Pension information concerning the fiscal years 2011 and 2012 are presented below ($ in millions): Information Provided by Pension Plan Actuary:...
-
(a) Explain four reasons why multinational corporations (MNCs) forecast exchange rates. (b) (4 marks) SPL Limited, a company based in Kenya expects to receive 2 million Euros in one year's time. The...
-
For each of the following, identify which GAAP, if any, has been violated. 1. A customer called and made arrangements for Jay's Plumbing to provide $6,000 of services next month. Jay, the owner,...
-
What is the support for the association rule bread milk? What is the confidence for this rule? What is the support for the sequential pattern {bread} {butter}? What is the confidence for this...
-
Motsamai Ltd was registered on 1 April 2018 with an authorised share capital of 500 000 ordinary shares of R2,00 each. 250 000 ordinary shares were taken up and paid for by the founders and the...
-
Alexander Company has a contract to sell 360 units to a customer for $25920. After 300 units have been delivered, Alexander modifies the contract by promising to deliver 35 more units for an...
-
5. A 90-day note promises to pay Ms. Chiu $2000 plus simple interest at 13%. After 51 days it is sold to a bank that discounts notes at a 12% simple interest rate. 2169 a) How much money does Ms....
-
The underlying intent of this problem is to demonstrate the ignorance of adding cash flows across time, once a person understands time value of money. (Each part is worth 1 pt.) (a) Loan A: You...
-
Using the fact pattern for Mr. and Mrs. Cash and assuming that they will be filing a joint Chapter 7 Bankruptcy case, complete Schedules D, E/F, the Statement of Intentions and Attorney's Disclosure...
-
11.4 (a) Sterling silver is an alloy of silver with 7.5 per- cent copper. Describe the structure that one should expect if a specimen of sterling silver were to be heated from room temperature to...
-
Open Text Corporation provides a suite of business information software products. Exhibit 10-9 contains Note 10 from the companys 2013 annual report detailing long-term debt. Required: a. Open Text...
-
This question refers back to the U.S. News & World Report graduate school data presented in Problem 22 in Chapter 17. a. Suppose that a two-way ANOVA is to be performed, with 1995 starting salary as...
-
The following table gives the performance competency scores for a random sample of family nurse practitioners (FNPs) with different specialties, from hospitals in three cities. a. Classify each...
-
a.-e. Repeat Problem 8, parts (a) through (e), but use orthogonal polynomials. f. Compare the results obtained here to those obtained in Problems 8 and 9. Problem 8 This problem uses the data...
-
Many states have lotteries that involve the random selection of digits 0, 1, 2, ,
-
Birth weights in the United States are normally distributed with a mean (in grams) of 3420 g and a standard deviation of 495 g. If you graph this normal distribution, the area to the right of 4000 g...
-
Is the distribution of those digits a normal distribution? Why or why not?
Study smarter with the SolutionInn App