Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Matlab has built-in functions for performing numerical integration (also known as quadrature). To use them, you need to provide the result of the integrand in
Matlab has built-in functions for performing numerical integration (also known as quadrature). To use them, you need to provide the result of the integrand in a Matlab function. The integrand from our equation is shown below 282, dr integrand Our integrand can be placed in a function as follows: func_integrand_viscdise.m function f = func_integrand viscdisc(mu, h, omega, r) 2 f = (2. "pi. *mu.*omega./h)*r.3; 3 end Again, the function name must match the name of the file it is placed in, func_integrand_viscdisc. m. This is the method Matlab uses to find the function. Note that all the operators are prefixed with a . This is because the built-in quadrature expects to operate on vector arguments. Operators prefixed with a individually operate on each element of a vector. In our case, we have vectors with one element. The driver below is used to evaluate the integral using Matlab's built-in quadrature method: driver_integrand_viscdisc.m 2 mu = 5.0E-3; h = 2.0E-3; omega = 100/60*2*pi; rmin = 0.0; rmax = 0.2; integrand viscdisc = @(r) func_integrand viscdisc(mu, h, omega, r): moment = integral (integrand_viscdisc, rmin, rmax); fprintf('The moment is: $11.4e_Nm ', moment): On line 8, the built-in quadrature method is called on our function over the range rmin to rmax. The built-in quadrature takes as its first argument a function describing the integrand, but this function can only have one parameter, the variable of integration r. Therefore, on line 7. we first create a new function called integrand viscdisc from our original function. Note that our original function had four parameters, mu, h, omega, and r. The syntax the statement on line 7 creates the new function with the single parameter r. while fixing the values of the other parameters. Specifically, integrand viscdisc is a handle to our function with some of the parameters fixed. Hand in a printout of all your code and the result from executing it
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started