Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using MATLAB Please do not use for and while loops Please copy and paste the code Type or paste question here x1 x3 x5 x?
Using MATLAB
Please do not use for and while loops
Please copy and paste the code
Type or paste question here
x1 x3 x5 x? 1+31 +51 + 1 + ... (inifinite terms) describes the hyperbolic sine or sinh function. Write a MATLAB script (M file) to compute an approximation to this function by truncating the sum after a finite number of terms, i.e. x1 x3 x5 x? sinh2(x,n) = utat att.. n terms). In order to do this, complete the following steps in an M file named hypersine.m (a) Read/Input n (the number of terms in the sum approximation) and x (the function argument) from the user. Make sure you let the user know clearly what to input and display the inputted values. (b) Create a vector On which contains the first n odd integers, i.e. 1,3,5 .. (n terms) (c) Using On, create a vector Xn which contains the terms x, x', X... (n such terms). (d) Using On, create a vector in which contains the factorials of first n odd integers. Thus the terms in the Fn vector should be 1!, 3!, 5! ... and so on up to n terms. (e) Using Fn and Xn, create vector Zn which contains n terms x/1!, x/3!, x/5! ..... (f) Sum the terms in Zn to compute the value of sinh2(x,n). (g) Compare the result to the actual value of sinh(x), which can be estimated using an in- built MATLAB function. Indicate the error as a fraction of the actual value. Once you've created the M file, open a new live script and write in the following commands before executing (run all) the live script and saving to PDF. During execution, enter n = 6 and x=4. Make sure all vectors On, Xn, Fn, Zn and values in (f) and (g) are displayed during execution. Upload PDF to WTClass Exam. %NAME, PROBLEM, DATE type hypersine.m hypersineStep 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