Question

MATLAB ASSIGMENT 1. A. Create a function called ch16initials3 Input: row vector of 101 values (Note:...

MATLAB ASSIGMENT

1.

A. Create a function called ch16initials3

Input: row vector of 101 values (Note: input values are specified in the function call)

Output: calculated maximum value

Create a row vector A of values from 50 down to 0, with an increment of 0.5 Multiply the elements of A and the square of the elements of the input vector Store the results in B Find the maximum value of B and store it in C – this is the output of the function

B. Create a program file called ch16initials4 Create a vector 0 to 200, increments of 2 Call the function Ch16initials3 with this vector as input; assign the output to the variable maxval Display the value of maxval

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer 1:

ch16initials3.m:

% ch16initials3.m
function C = ch16initials3(v)
    A = 50:-0.5:0;
    B = A.*(v.^2);
    C = max(B);
end

ch16initials4.m:

% ch16initials4
v = 0:2:200;
maxval = ch16initials3(v);
disp(maxval);

OUTPUT:

FOR ANY HELP JUST DROP A COMMENT

Add a comment
Know the answer?
Add Answer to:
MATLAB ASSIGMENT 1. A. Create a function called ch16initials3 Input: row vector of 101 values (Note:...
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
  • Matlab: Write a function called minimax that takes M, a matrix input argument and returns mmr,...

    Matlab: Write a function called minimax that takes M, a matrix input argument and returns mmr, a row vector containing the absolute values of the difference between the maximum and minimum valued elements in each row. As a second output argument called mmm, it provides the difference between the maximum and minimum element in the entire matrix. See the code below for an example: >> A = randi(100,3,4) A = 66 94 75 18 4 68 40 71 85 76...

  • MATLAB Onramp ASSIGNMENT: 2. Create a 1x15 (1 row, 10 columns) vector of random numbers (use...

    MATLAB Onramp ASSIGNMENT: 2. Create a 1x15 (1 row, 10 columns) vector of random numbers (use randn command “x = randn(1,10)). And do the following: a.Test vector x for elements that are less than 0.2. Assign the output to a variable named y. b.Create a variable z that contains the elements in x that are greater than 0.2. c. Modify vector x such that any value in it less than 0.2 is replaced by value 0.

  • MATLAN Quiz 2 Create a MATLAB function that calculates the average of values in a vector that als...

    MATLAN Quiz 2 Create a MATLAB function that calculates the average of values in a vector that also drops the slowest values. Call this function average_drop(). The function must have a single input (the vector) and a single output (the average without the lowest score). 1. 2. Create a MATLAB program that asks the user to input grades for a student and calculates the final grade and letter grade. The user must enter 5 quiz grades (worth 50% of the...

  • MATLAB Write the proper 'display header' for each part. Give a short comment in front of...

    MATLAB Write the proper 'display header' for each part. Give a short comment in front of each line as needed. (1a)-Create a variable calls final_value which is holding a value of 30. (1b)-Create a row vector from 20 to the final_value with an increment of 8.(Do not use the value of final_value). Next, assign this vector to a variable calls row_vec1. (1c)-Use the length() function to create another row vector using linspace() from 2 to 56 and assign it to...

  • Please write the code using matlab 1) i. Create an anonymous function named optimist, that accepts...

    Please write the code using matlab 1) i. Create an anonymous function named optimist, that accepts a single variable as input i Create a row vector Tthat represents the number of seconds in two minutes, starting ii. Call the function optimist on the vector T, store the result in variable R1 and returns the double of that variable from one and ending at a hundred and twenty v. Create an anonymous function named pessimist, that accepts a single variable as...

  • Write a function called ''minandmax'' . Function ''minandmax'' takes only one input argument that is a...

    Write a function called ''minandmax'' . Function ''minandmax'' takes only one input argument that is a matrix M . This matrix M can be any size (any number of columns and rows) with any random integer values . Function ''minandmax'' returns two output arguments. The first output argument is called ''difference_row'' that returns a row vector containing the absolute values of the difference between the maximum and minimum valued elements in each row. The second output argument is called ''difference_all''...

  • MATLAB Homework 3- Due:5/20/2018 1. Create a function that receives the following input data, and prints...

    MATLAB Homework 3- Due:5/20/2018 1. Create a function that receives the following input data, and prints the output as the summation of the diagonal elements (The elements which are located at the intersection of similarly numbered rows and columns) Input (Matrix A) Output (Scalar B) Example 2 -1 4 3 -45 ? B = A( 1,1) + A(2,2) = 2-4 =-2 A4 5 ?41 ? B = A(1,1) + A(2,2)--1-4-5 -3 1 1.5 -4 3.2 -1 06 1.78 2.22 -4.56...

  • 1) Create a matlab function that calculates: for Name your function TwoVarFunc : The inputs should...

    1) Create a matlab function that calculates: for Name your function TwoVarFunc : The inputs should be in the same order: xmin xmax ymin ymax N: n is the number of elements in the vector x and y The ouputs should be in the same order: f_xy: is the calculated array f(x,y) f_xyMAX: should be the the maximum value of the function f(x,y). Hint: to create vectors x and y look up the matlab built-in function linspace() Hint 2: To...

  • Create a MATLAB function to perform Lagrange Interpolation. Your function will be used as illustrated below:...

    Create a MATLAB function to perform Lagrange Interpolation. Your function will be used as illustrated below: >> ya = Lagrange(x, y, a) where "x" is a vector of ? independent data values, "y" is a vector of ? dependent function values corresponding to "x", "a" is an arbitrary value of "x" for which you want to know the Westimate of "y", and "ya" is the estimate of the function at x=a. Print an error message and exit the function if...

  • I just need some matlab help and assistance Refresher 1. Create a vector called A containing...

    I just need some matlab help and assistance Refresher 1. Create a vector called A containing 1, 2, 3,4, and 5 2. Create a vector called B containing 6,7, 8, 9, and 10 . Combine A and B to create an array called C where A is the first row and B is the second row 4. Find the 7th element in C 5. Determine the location of 8' in array C

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
ADVERTISEMENT