Question: By using matlab solve these questions. Functions create a function (in a function m-file) that has one input and one output. Both the input and
By using matlab solve these questions.


Functions create a function (in a function m-file) that has one input and one output. Both the input and output variables will be scalars. If the input is x, the output y should be I. tan(nx) Your function should deal with the special case where the input x is o. Notice that this 0. (In other words, if you plug mathematical function is an indeterminate form for x fact that into the function, you get oo.) However, we can take advantage of the tan(nx) x 0 TTX Your function should check ifx 0. If it is, then the mathematical expression should not be evaluated and 1 should be returned by the function. Save this function m-file. It will be used in the next exercise. 2. Create a script that contains a for-loop. This loop should execute 5 times. With the loop, there should be a call to the function you created in exercise 1 (above). Your script should call the function for the following 5 values ofx: 0, w/4, 3n/8, t/2. Display the results. 3. Create a function (in a function m-file) that has one input and one output. At present, both the input and output variables will be scalars. (That will change in the next exercise.) If the input is x, the output y should be y 2cos (x) sin? (2x) 2 sin (x) Call this function directly from the command window, using an example value for x. Display the result. Save this function m-file. It will be modified in the next exercise. 4. Edit the function of exercise 3 so that the input and output are both vectors. Save this modified function m-file. It will be used in the next exercise. 5. Create a script that generates a vector having the values: 0, m/4, t/2, 3w/4,and m. Call the function of exercise 4 with this vector as input. Display the results. 1 of 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
