Homework Help Question & Answers

X) -1-2! +41-614 (2k)! k=0 he actual Write a script that will determine how many terms are needed...


x) -1-2! +41-614 (2k)! k=0 he actual Write a script that will determine how many terms are needed in the series to get the er
x) -1-2! +41-614 (2k)! k=0 he actual Write a script that will determine how many terms are needed in the series to get the error between t value and the estimate to be less than 0.0001. The user should input the value of x and a formatted print statement should be used to display the result. Use a while loop to complete this problem. Note: error I(cos 2x)actual - (cos 2x)estimatel. See below for an example. Enter a value of x: 5 16 terms are needed to meet the tolerance
0 0
Next > < Previous
ReportAnswer #1

MATLAB CODE---------------------------

x=input('Enter value of x');

x1=(x*pi)/180;

COS2x_Actual=cosd(2*x)

n=0;

Error=1;

COS2X_estimated=0;

while (Error>0.0001)

COS2X_estimated =COS2X_estimated +(((-1)^(n)*((2*x1)^(2*n)))/factorial(2*n))

Error = abs(COS2x_Actual-COS2X_estimated)

n=n+1;

end

fprintf('\n\n%d terms are needed to meet the tolerance',n)

OUTPUT----------------TEST---------------------OF-----------CODE

Enter value of x> 45
COS2x_Actual = 0
COS2X_estimated =  1
Error =  1
COS2X_estimated = -0.23370
Error =  0.23370
COS2X_estimated =  0.019969
Error =  0.019969
COS2X_estimated =   -8.9452e-04
Error =    8.9452e-04
COS2X_estimated =    2.4737e-05
Error =    2.4737e-05


5 terms are needed to meet the tolerance
 
 
Enter value of x> 5
COS2x_Actual =  0.98481
COS2X_estimated =  1
Error =  0.015192
COS2X_estimated =  0.98477
Error =    3.8624e-05


2 terms are needed to meet the tolerance
Know the answer?
Add Answer of:
X) -1-2! +41-614 (2k)! k=0 he actual Write a script that will determine how many terms are needed...
Your Answer: Your Name: What's your source?
Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This is a matlab HW that I need the code for, if someone could help me figure this out it would b...

    This is a matlab HW that I need the code for, if someone could help me figure this out it would be appreciated. The value of t can be estimated from the following equation: in your script file, estimate the value of π for any number of terms. You must ask the user for the desired number of terms and calculate the absolute error/difference between your calculation and the built-in MATLAB value ofpi. Display your results with the following message...

  • Instructions: Submit your script in a file named hwk08.m to the dropbox before 11:59 pm on the du...

    Instructions: Submit your script in a file named hwk08.m to the dropbox before 11:59 pm on the due date NOTE: This assignment is neither quick nor simple. You will be well served to start on it early, and to ask for help if you need it. Being a more substantial assignment than earlier hwk, it is worth- s. When you ask your calculator for the value of a function for a specified argument, (e.g., sin(22), cos(74), In(6.5)), it almost certainly...

  • REOM eShons.mbOuiz 2 Takehome Questions.mbkXQuiz 2 Takehome Questi Question 9 %0 write a script that will...

    REOM eShons.mbOuiz 2 Takehome Questions.mbkXQuiz 2 Takehome Questi Question 9 %0 write a script that will use the "menu" function to present the user with choices for functions "fix", "floor, and "ceil". Error-check by looping to display the menu until the user pushes one of the buttons (an error could occur if the user clicks on the "X on the menu box, rather than pushing one of the buttons). Then, generate a random number and print the result of the...

  • This is my matlab HW. I need the code to enter into matlab. There are three parts to this HW.Part...

    This is my matlab HW. I need the code to enter into matlab. There are three parts to this HW.Part 2 Part 3 This is hints that came along with the hw %% Part 1 Using for loops, create the following 10 × 10 matrices. Preallocate your matrix using zeros (10). In other words, fill a matrix with zeros that is the same size as your final matrix. Display your FINAL matrices only to the command window using the disp...

  • Part 2 to the problem in matlabthis is the hint that came with the problem

    part 2 to the problem in matlabthis is the hint that came with the problem The value of T can be estimated from the following equation: In your script file, estimate the value of t for any number of terms. You must ask the user for the desired number of terms and calculate the absolute error/difference between your calculation and the built-in MATLAB value ofpi. Display your results with the following message (including the asterisks) where II is the number...

  • Write VBA functions to calculate sin (x) using the Maclaurin arcsine series, and compare the values...

    Write VBA functions to calculate sin (x) using the Maclaurin arcsine series, and compare the values for sin-1(x) from your program to those given by the Excel spreadsheet function ASIN(x). The Maclaurin arcsine expansion is given by x 3x 6 40 (2n)! sin1(x)-2((2n+1) Note: This function by definition is only defined for-1 SxS1. When you write the code for calculating it, you will need to include code that assigns a value to it that reflects it is undefined for values...

  • Create a NOTEPAD or PDF file that restates the problem in your own words, specifies what input is needed, w...

    Create a NOTEPAD or PDF file that restates the problem in your own words, specifies what input is needed, what output is expected, the step by step process (algorithm) to get the output from the input, and test data (input for which you know the expected output) for each of the 3 problems given below. You should not write any actual C++ code. Make sure the problem statement is in your own words and is descriptive enough so someone not...

  • I want to find the part1 part2 part3 waveform mathematically. how slove?? please help me!! part 1 part 2 part 3 opampadder ed Q (normal) R3 2k U1 R1 in 1 out V1 1 k R4 100 SINE (0...

    I want to find the part1 part2 part3 waveform mathematically. how slove?? please help me!! part 1 part 2 part 3 opampadder ed Q (normal) R3 2k U1 R1 in 1 out V1 1 k R4 100 SINE (0 1 1k) R2 in2 cir ures of tics of s. Mor discu ssuming V2 1k .tran 0 0.005 .lib opamp.sub SINE(0 0.5 1k 0 0) opampadder.raw idal ip ave a fr V(in1) V(in2) V(out) 3.0V 2.4V 1.8V 1.2V 0.6V 0.0V 6.16....

  • Comp220 iLab Week 1

    I need help with the entire coding below.I tried referring back to my last class for a few hints but could find nothing to compare to.Week 1: Two-Dimensional Arrays - iLabPrint This PageiLab 1 of 7: Two-Dimensional ArraysConnect to the iLab here.Use This Only if you Don't haveVisual Studio Installed on your PCSubmit your assignment to the Dropbox located on the silver tab at the top of this page.(See Syllabus "Due Dates for Assignments &Exams" for due dates.)i L A...

  • How can we assess whether a project is a success or a failure? This case presents...

    How can we assess whether a project is a success or a failure? This case presents two phases of a large business transformation project involving the implementation of an ERP system with the aim of creating an integrated company. The case illustrates some of the challenges associated with integration. It also presents the obstacles facing companies that undertake projects involving large information technology projects. Bombardier and Its Environment Joseph-Armand Bombardier was 15 years old when he built his first snowmobile...

Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
Share Your Knowledge

Post an Article
Post an Answer
Post a Question with Answer

Self-promotion: Authors have the chance of a link back to their own personal blogs or social media profile pages.