Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

I wrote this program (with a lot of help) that finds multiple roots using bisection. For example, this program found the first 10 roots of cos(5x). Now, I'm supposed to find and store the first 50 roots of
Where
= 50; L = 200; = 0.447; = 4.47
= 25; L= 200; = 0.748; = 1.875
= 15; L= 200; = 0.045; = 19.25

The instructions say: Now we must only modify the variable that determines the number of roots to find. We must also refine (i.e. improve) the bracket search algorithm so that roots that are not evenly spaced can be found. Test your algorithm by finding the roots for at least three different combinations of the parameters and L. How can you verify that your algorithm has not missed any of the roots? HINT: Consider the maximum frequency (dig back to that trig you forgot) to help determine the size of an appropriate bracket for this part of the problem.

(1) I only understand the first sentence of these instructions. How do I modify my program to find those 50 roots and, yes, how can I verify that my algorithm has not missed any of the roots?

(2) Also, could you please describe what each line of the main program is doing? I understand the subprogram, ‘bisection,' pretty well. I know the two programs are similar.
Main Program (for finding first 10 roots of cos(5x))

function root=multibisection(func,j,xtol,ftol)
xlower=0;
xupper=xlower+j;
ylower=feval(func,xlower); %takes func and evaluates xlower into that function
yupper=feval(func,xupper);
i=1;
while i<11
ylower=feval(func,xlower); %takes func and evaluates xlower into that function
yupper=feval(func,xupper);
if abs(ylower) root=xlower;
return
elseif abs(yupper) root=xupper;
return
end

while (yupper*ylower)>0
xlower=xupper;
xupper=xlower+j;
yupper=feval(func,xupper);
ylower=feval(func,xlower);
end
b=bisection(func,xlower,xupper,xtol,ftol);
roots(i)=b;
i=i+1;
xlower=b+j;
xupper=xlower+j;
end
roots
format long


Sub Program
function root=bisection(func,xlower,xupper,xtol,ftol)

xroot=(xlower + xupper)/2;
yroot=feval(func,xroot);
count=0;

while abs(yroot)>ftol;
ylower=feval(func,xlower); %takes func and evaluates xlower into that function
yupper=feval(func,xupper);
if ylower*yroot<0;
xupper=xroot;
yupper=yroot;
else
xlower=xroot;
ylower=yroot;
end

if abs(xupper-xlower) root=xroot;
return
end
root=xroot;

xroot=(xlower + xupper)/2;
yroot=feval(func,xroot);

count=count + 1;
if count>500 %max number of iterations
count
range=xupper-xlower
disp ('too many interval halvings, stopping ...')
root=xroot
return
end
end %ends the while loop

Line4 m-file
function y=line4(x)
y=cos(5*x);

Testing:
>> multibisection(@line4,0.314,1e-11,1e-11)

roots =

Columns 1 through 4

0.31415926533914 0.94247779608140 1.57079632675968 2.19911485721864

Columns 5 through 8

2.82743338823505 3.45575191891333 4.08407044967386 4.71238898037956

Columns 9 through 10

5.34070751111268 5.96902604181838

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91615176
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Couriers such as ups and fedex complete on service and

Couriers such as UPS and FedEx complete on service and price. One way to reduce cost is to keep labor cost low by hiring and laying off workers to meet the demand. This strategy requires managers to hire and train new wo ...

As the school year begins what trends are taking place with

As the school year begins, what trends are taking place with Educational Technology in schools?

Task working with arrays in matlabnbspcreate a matlab

Task : Working with Arrays in MatLab  Create a MatLab script called a2taski.m that computes the following tasks. The answers will appear in the Workspace. To view the larger structures, e.g., matrix A in Part 1 double cl ...

If 1220 grams of rbcl are dissolved in water to make a

If 12.20 grams of RbCl are dissolved in water to make a solution of0.223 L, the density is found to be 1.040 g/cm 3 . Calculate the molality of the solute.

Why is scenario manager useful to a manager wanting to use

Why is Scenario Manager useful to a manager wanting to use a model developed with Excel to help make a business decision such as whether to expand his business? When should a manager use the Excel Solver?

Represent the number obtained by the last you have digits

Represent the number obtained by the last you have digits of your student number in binary, e.g., if your student number is XXX8372 then the question is to represent "8372" in binary. Also, represent the first three digi ...

Suppose there are two links between a source and a

Suppose there are two links between a source and a destination. The first link has transmission rate 200 Mbps and the second link has transmission rate 15 Mbps. Assuming, that the only traffic in the network comes from t ...

1 a cpu manufacturing company knows based on the machines

1. A CPU manufacturing company knows, based on the machines working at maximum productivity, that 90% of the CPU's coming off the line meet quality standards. The quality control inspector pulls 25 CPU's off the line to ...

Identify at least two 2 factors that have led to the

Identify at least two (2) factors that have led to the explosive growth of digital crime over the past a few decades. Next, describe the most common forms of digital crime, and give your opinion as to why those forms you ...

Using c language how to write a function name bsqrt that

Using C++ language, how to write a function name bsqrt that will compute the square root of a number using the Babylonian method. This function will take the number x to compute the square root for and the number of iter ...

  • 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