1

Please help with MATLAB problem Problem 5 (15 points) Determine the following integral Icos (sin (e"))...

Question

Please help with MATLAB problem Problem 5 (15 points) Determine the following integral Icos (sin (e"))...

Problem 5 (15 points) Determine the following integral Icos (sin (e)) dz with an estimated relative error below 10s. The arg please help with MATLAB problem
Problem 5 (15 points) Determine the following integral Icos (sin (e")) dz with an estimated relative error below 10s. The arguments to the trigonometric functions are in radians. Make sure that when calculating estimated relative errors, the number of subintervals used, increases at least by a factor of 2. Problem 5 required submisson: Softcopy printout of well commented script you coded to solvc this problem . State which method you have chosen: . Softcopy printout of I and its estimated relatine error of your final ansuer: Upload of your Matlab functions and scripts to the Homewors 6 link on Canvas

Answers

%given function

function y=myFunction(x)

y=sin(cos(e.^x));

end

%functon to find the integral

function Int=myIntegral(f,a,b)

%max no. of iterations

maxIt=20;

%allowed relative error

maxError=1e-8;

%variable for convergence

con=0;

%loop variable

kk=1;

%storing each level integral value

T=zeros(maxIt,maxIt);

%multiple of 2

N=2;

%sub intervals

h=(b-a)/2;

%T(1,1) by trapezoidal rule

T(1,1)=h*(f(a)+2*f(a+h)+f(b))/2;

%loop to find the integral value

while ~con && kk<=maxIt

%increment kk

kk=kk+1;

%increment N by factor of 2

N=2*N;

%calculate new sub intervals

h=(b-a)/N;

%for holding sum

oddSum=0;

%loop

for mm=1:2:(N-1)

oddSum=oddSum+(f(a+mm*h));

end

%find T(kk,1)

T(kk,1)=T(kk-1,1)/2+h*oddSum;

%Romberg method

for mm=2:kk

T(kk,mm)=(4^(mm-1)*T(kk,mm-1)-T(kk-1,mm-1))/(4^(mm-1)-1);

end

%check for convergence

con=abs(T(kk,kk)-T(kk,kk-1))<=maxIt*abs(T(kk,kk));

end

%check if integral value converged

if con

Int=T(kk,kk); //integral value

end

end

%call myIntegral

I=myIntegral(@myFunction,0,4)


Similar Solved Questions

1 answers
How do I solve this? When 597 J of heat are added to a gas, it...
How do I solve this? When 597 J of heat are added to a gas, it expands. Its internal energy increases by 318 J. How much work does the gas do? (Be careful with +and - signs. +Wexpansion, +Q-added, +AU temp goes up.) (Unit J)...
1 answers
Presented below is information related to Coronado Inc.’s inventory, assuming Coronado uses lower-of-LIFO cost-or-market. (per unit)...
Presented below is information related to Coronado Inc.’s inventory, assuming Coronado uses lower-of-LIFO cost-or-market. (per unit) Skis Boots Parkas Historical cost $254.60 $142.04 $71.02 Selling price 284.08 194.30 98.83 Cost to distribute 25.46 10...
1 answers
A doctor is assisting with a patient’s MRI when the patient states he is feeling light-headed....
A doctor is assisting with a patient’s MRI when the patient states he is feeling light-headed. The doctor rushes into the room and quickly reaches into the MRI to check the patient’s pulse and claims she could feel an effect on her ring when she reached into the MRI. You want to check th...
1 answers
Entries for Selected Corporate Transactions Selected transactions completed by ATV Discount Corporation during the current fiscal...
Entries for Selected Corporate Transactions Selected transactions completed by ATV Discount Corporation during the current fiscal year are as follows: Instructions: Journalize the transactions. If no entry is required, select "No Entry Required" from the dropdown box and leave the amount box...
1 answers
The figure shows the E-field in the plane of two point charges. FalseQ1 and Q2 have...
The figure shows the E-field in the plane of two point charges. FalseQ1 and Q2 have the same sign. True Q1 is negative. FalseThe magnitude of E is the same at a and b. FalseA - charge at a would accelerate to the right. True The size of Q1 is larger than that of Q2 False A charge at a would accelera...
1 answers
Please use the information below for the following questions: Twenty pediatric patients were asked if they...
Please use the information below for the following questions: Twenty pediatric patients were asked if they live with both parents (B), mother only (M), father only (F), or someone else (S). The responses were as follows: M B B M F S B M F M B F B M M B B F B M a. Determine the frequency for patients...
1 answers
Explain what is meant by downward spiral in the life of an elderly?
Explain what is meant by downward spiral in the life of an elderly?...
1 answers
Come up with a categorical map of BIM benefits to different stakeholders (e.g. owner, architect,
Come up with a categorical map of BIM benefits to different stakeholders (e.g. owner, architect,...
1 answers
6) Campaign Services hired a new accounting manager. He signed a contract for 6) a new...
6) Campaign Services hired a new accounting manager. He signed a contract for 6) a new accounting information system, but his position did not specify whether he was authorized to do so or not. In the above situation, which internal control procedure needs strengthening? A) separation of duties B) d...
1 answers
Using Solver to Find the Optimal Stock Portfolio Five investors plan to pool the fund and...
Using Solver to Find the Optimal Stock Portfolio Five investors plan to pool the fund and create a stock portfolio together. Based on their unique expertise and analysis, their investing preferences are as follows: • Adam has a total amount of $50,000 and is only willing to invest in Google, Fa...
1 answers
Statement of Cash Flows (Direct Method) The Wolff Company's income statement and comparative balance sheets at...
Statement of Cash Flows (Direct Method) The Wolff Company's income statement and comparative balance sheets at December 31 of 2013 and 2012 are shown below: WOLFF COMPANY Income Statement For the Year Ended December 31, 2013 Sales Revenue $825,500 Cost of Goods Sold $559,000 Wages Expense 111,80...
1 answers
Write a declaration for a global array called words. Explain where the code should be placed...
Write a declaration for a global array called words. Explain where the code should be placed so it is global....
1 answers
12.21 Using what you know about the expanded source table, fill in the missing values in...
12.21 Using what you know about the expanded source table, fill in the missing values in the table shown here: Source Gender Parenting style df MS F 1 SS 248.25 84.34 33.60 1107.2 Gender X style Within 36 Total...
1 answers
1. What is an abstract method and why are they useful? Illustrate your answer using an...
1. What is an abstract method and why are they useful? Illustrate your answer using an example of where you might use an abstract method. 2. What is the difference between a static variable and a non-static variable? Given the example of a class representing Dogs, give an example of a variable that ...
1 answers
C++ (Apartment problem) A real estate office handles, say, 50 apartment units. When the rent is,...
C++ (Apartment problem) A real estate office handles, say, 50 apartment units. When the rent is, say, $600 per month, all the units are occupied. However, for each, say, $40 increase in rent, one unit becomes vacant. Moreover, each occupied unit requires an average of $27 per month for maintenance. ...

-- 0.015265--