Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

12) a) Write a script which is similar to mysum2a or my sum2b, but for Tn = where To = 1/90 b) Now write a

image text in transcribedimage text in transcribedimage text in transcribed

12) a) Write a script which is similar to mysum2a or my sum2b, but for Tn = where To = 1/90 b) Now write a slightly different script which adds the terms from smallest to largest. That is, in the previous part 1 In=1+2+31+ while in this part it is Tabulate the results of both scripts in one table as n o rr T_1 err Trev_n The names of these scripts should be mysumt.m and mysumt_rev.m, the input n, and the output s, the sum Note: Follow the directions in the Notes at the beginning of this problem set. (5.3) for some positive integer n. (Incidentally, lim - Sn = 162 as we discuss in Section 11.4.1.8.) This is similar to the last code, but we have to explicitly calculate the ith term. The code is % script m-file: mysum2a % input: % output: 5 % DON'T USE sum FOR THE VARIABLE NAME S - 0; for i - 1:n S-S + 1/i-2; end or, if we want to explicitly calculate the current term, % script m-file: mysum2b % input: n % output: 5 % DON'T USE sum FOR THE VARIABLE NAME S - 0; for i - 1:n t - 1/i-2; s-sut; end Note: All the scripts in these problems must be written as shown in this section. The input must be calculated outside the code and the output must be printed outside it unless otherwise noted. Either generate the input and print the output in a different script, or do it in the Command Window. Note: You can only use for or while loops and if tests in your codes. None of the MATLAB functions max, min, sum, find, or sort can be used, and logical variables are also not allowed. Note: Many of these problems require you to "Include tests to verify ...". This is an incredibly important part of a problem: first, get it to run, and, second, get it to run correctly

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Finance The Role Of Data Analytics In Manda Due Diligence

Authors: Ps Publishing

1st Edition

B0CR6SKTQG, 979-8873324675

More Books

Students also viewed these Databases questions