User Defined Function Matlab You are given the following vector: Write a functio
ID: 675307 • Letter: U
Question
User Defined Function Matlab You are given the following vector: Write a function that has 2 inputs: The cut-off, C, and An array, A; and 3 outputs: A vector of zeros and ones (1's represent values greater than P and 0's represent values less than or equal to C An array of the indices of the elements in A that are greater than C A total of how many values are above the threshold. For example if the cutoff point is 17, the script file should return the following vector. Use the vector A given above and show the following cases:Explanation / Answer
function [E t n]= mymax(A,c)
n=1
for i=(1:length(A))
if A(i)>c
E(i)=1
t(n)=i
n=n+1
else
E(i)=0
end
end
n=n-1
end
y=[]
t=[]
n=1
mymax([18 334 98 73 129 7 62 9 212 55 3],17)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.