Question: Please solve using MatLab ONLY. Computational Modeling Part 1 Consider the following two equations that are to be computed in a function. Create a mat

Please solve using MatLab ONLY.

Computational Modeling

Part 1

Consider the following two equations that are to be computed in a function. Create a mat lab function to compute x and y quantities (call the function ComputeXY and save as a file named ComputeXY.m .

x = cos (at ) + b

y = |x| + c

Where:

t = [0, pi/4, pi/2, 3*pi/4, pi],

a = 1.4,

b = 2.0,

c = 0.75,

The values of x and y are to be returned by the function. Show the input/output from the command window.

Part 2

In some instances, the number of different variables that are transferred to a function can become large. In these cases, it may be beneficial for the function to share the global memory of the script or function or to create access to global variables for use by various functions.

Create a matlab function to compute x and y quantities in previous question (4) by transferring the values of (a, b, and c) in ComputeXY function you created as global variables. Compare the values of x and y from this function using global variables definition with your answer from previous question.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!