Computer Programming with Matlab Exercises

Computer Programming with Matlab Exercises

Computer Programming with Matlab Exercises

1 attachmentsSlide 1 of 1

UNFORMATTED ATTACHMENT PREVIEW

1. True or False. (1 points each) a. All user defined functions must have at least one input and one output variable. b. All.m files containing functions must begin with a function header. 2. Write a MATLAB function called Trigs that: (9 points) • Accepts a single angle or vector of angles in radians as an input argument. • Computes the Sine, Cosine, and Tangent of the input angle(s). Returns all three values/vectors as separate output variables. . 3. Write MATLAB code that calls your function with an angle of your choice as input and saves the result in the variables a (sine), b (cosine), and c (tangent). (4 points) 4. Write MATLAB code that uses the fplot to plot the anonymous function f(x)= x2+5x-3 for an x range of negative thirty to positive thirty. (5 points) Extra Credit (5 points): a) Write a MATLAB function with no inputs or outputs that calculates and displays the average of the data in a global vector called “nums”. (3 points) b) Write MATLAB code to define “nums” with any 5 numbers and then calls your function from part a. (2 points)

Do you similar assignment and would want someone to complete it for you? Click on the ORDER NOW option to get instant services at LindasHelp.com


Computer Programming with Matlab Exercises

1 attachmentsSlide 1 of 1

UNFORMATTED ATTACHMENT PREVIEW

1. True or False. (1 points each) a. All user defined functions must have at least one input and one output variable. b. All.m files containing functions must begin with a function header. 2. Write a MATLAB function called Trigs that: (9 points) • Accepts a single angle or vector of angles in radians as an input argument. • Computes the Sine, Cosine, and Tangent of the input angle(s). Returns all three values/vectors as separate output variables. . 3. Write MATLAB code that calls your function with an angle of your choice as input and saves the result in the variables a (sine), b (cosine), and c (tangent). (4 points) 4. Write MATLAB code that uses the fplot to plot the anonymous function f(x)= x2+5x-3 for an x range of negative thirty to positive thirty. (5 points) Extra Credit (5 points): a) Write a MATLAB function with no inputs or outputs that calculates and displays the average of the data in a global vector called “nums”. (3 points) b) Write MATLAB code to define “nums” with any 5 numbers and then calls your function from part a. (2 points)

Do you similar assignment and would want someone to complete it for you? Click on the ORDER NOW option to get instant services at LindasHelp.com

Leave a Comment

Your email address will not be published. Required fields are marked *