Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following two functions written in Matlab: function [n] = countval( v,x ) n= sum(v == x); end and function [y] = myfn( v

image text in transcribed

Consider the following two functions written in Matlab: function [n] = countval( v,x ) n= sum(v == x); end and function [y] = myfn( v ) A = 0); for x = V A = (A; x, countval(v,x)]; end max(A(:,2)); [m, n] = size(A); for i = 1:m if A(1,2) == t y = A(1,1); return end t = end Answer the following. a. Describe in plain English what the function countval is doing. b. If the vector v = (10, 3, 10, 10, 4), what matrix A is made by myfn(v)? (Try to answer this without using Matlab, and then use Matlab to check your answer.) c. Describe in plain English what the matrix A represents (for a general input vector v). d. Describe in plain English what the output of myfn represents (for a general input vector v)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Application Development And Design

Authors: Michael V. Mannino

1st Edition

0072463678, 978-0072463675

More Books

Students also viewed these Databases questions

Question

Proficiency with Microsoft Word, Excel, PowerPoint

Answered: 1 week ago

Question

Experience with SharePoint and/or Microsoft Project desirable

Answered: 1 week ago