Question

Write a MATLAB function named my_calc • The function will have one input and one return value. • The first input, A, will be
0 0
Add a comment Improve this question Transcribed image text
Answer #1

A=[0.20 0.40 0.60 0.80]; %define array

M = my_calc(A); % call funtion

disp(M); %display values

function M = my_calc(A) %function my_calc taking A as input and Producing M as output

M = A*cos(pi/6) + 5*A.^3; %implement the formula (pi used as pi/6 = 30 degree)

end

A=[0.20 0.40 0.60 0.80]; %define array M = my_calc(A); % call funtion disp(M); %display values 0.2132 0.6664 1.5996 3.2528 fu

%if you face problem then ask in comment and please upvote if you like the answer :)

Add a comment
Know the answer?
Add Answer to:
Write a MATLAB function named my_calc • The function will have one input and one return...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a MATLAB function named top5_temps The function will have one input and two return values...

    Write a MATLAB function named top5_temps The function will have one input and two return values The input will be a list of temperatures recorded every minute in an electric arc furnace (for at least 6 minutes) The first return value of the function should be the number of datapoints in the list (number of minutes of data) The second return value should be a single value that is the average temperature for the 5 highest temperatures. Notes: Example Test...

  • MATLAB Required!! Write a MATLAB program named whileadder, to nput a desired maximum value. Be sure...

    MATLAB Required!! Write a MATLAB program named whileadder, to nput a desired maximum value. Be sure it is one value only Compute a running total by ones Return as output the last integer that can be added before the total exceeds max For example, if input max 60, the output should 10, because 1+2+3+4+5+6+7+8+9+10 : 55 and adding 11 would make the sum > 60M max- 55, then the output would be 10. Your Function C Reset MATLAB Documentation function...

  • Write a function named lengthDict with the following specifications: Input (parameters): t, a string Return: a...

    Write a function named lengthDict with the following specifications: Input (parameters): t, a string Return: a dictionary in which each key is the length of a word in t and the corresponding value is the number of words in t with that length. For example, the following would be correct output. text = "it is what it is" print(lengthDict(text)) {2: 4, 4: 1}

  • MATLAB 2019 The main function will have exactly one input and exactly one output. Using best...

    MATLAB 2019 The main function will have exactly one input and exactly one output. Using best practices, check the number of input arguments as well as the type of input. This function should only accept a vector (row or column). This also means that the value COULD be a scalar value. This function should accept scalars as well. The vector should be numeric, but can be any value: positive or negative, whole number or rational number. Throw a descriptive error...

  • In matlab, there is a function "size" that accepts an array as a parameter (or input...

    In matlab, there is a function "size" that accepts an array as a parameter (or input argument) and returns the dimensions of that array as another single-dimension array.      For example, if the array were 2 x 2, it would return [2 2]. Assume that input1 is a 1 or 2-dimensional array. Use the size function to obtain the dimensions and save the output into the return argument of this function "output1"     1Do not modify the line below 2-unction...

  • Needs to be in MATLAB. Create a function that accepts two numbers as input arguments and...

    Needs to be in MATLAB. Create a function that accepts two numbers as input arguments and returns one with the larger absolute value. The function must return an error message if the number of arguments is not 2.

  • Write a Matlab funtion that will produce a Z-table. The input of your function is a...

    Write a Matlab funtion that will produce a Z-table. The input of your function is a Z value z ranging from -4.00 to 4.00 (including -4 and 4). The output of your funtion is the entry prob in the Z table corresponding to your input. If the input is out of range, your function should return -1. You should using the Z table descriped as following: Table entryfor z is the standard normal curve to the left of z

  • Use MATLAB to program the following: 9. The MATLAB built-in function primes (x) finds all the...

    Use MATLAB to program the following: 9. The MATLAB built-in function primes (x) finds all the prime numbers less than x. Write a M-file function "addupprime" that will sum up all the prime numbers of an input number x. Run and show 2 test cases to demonstrate that your function file is correct.

  • This code NEEDS TO BE DONE IN MATLAB!!!! Write a function that takes one input, an...

    This code NEEDS TO BE DONE IN MATLAB!!!! Write a function that takes one input, an integer number n, and returns a matrix that is nxn, where the value of each number is the distance from the upper-left to bottom-right diagonal. (Use while loops if you can!) Numbers below the diagonal should be negative, and numbers above the diagonal should be positive. For example, if your input was 5, your output would be: 0 1 2 3 4 -1 0...

  • In this problem, you should write one function named copy and increment. This function will have...

    In this problem, you should write one function named copy and increment. This function will have one parameter, which you can assume will be a list of integers. This function should return a copy of the parameter list, in which each number from the parameter list has been increased by 1. The function should not modify the values in the parameter list. For example, the code: values - 20, 40, 10, 60, 77, 2) other copy and incrementales) print values...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT