Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

THIS IS A MATLAB CODING!!!! Think of a built-in function and how you would write

ID: 3696581 • Letter: T

Question

THIS IS A MATLAB CODING!!!!

Think of a built-in function and how you would write a function that does the same job.
As noted before, you should use built-in functions but the point here is about the practice you get from writing functions.

you only need one version of the function, in case the built-in function has many versions.
Please list the built-in function and describe what it is does in no longer than one or two lines, then show your function code.

ex)For a vector x, mean(x) is a built-in function that returns the mean value of the elements in x.
For example, if x = [1 2 3 4 5] then mean(x) returns 3.

CODE:
function output = calcMean(x)

sum = 0;  
N = length(x);
for ii = 1:N
sum = sum + x(ii);
end
output = sum / N;

end

please help me, i thought of sample example, but someone else has taken in my class!! please provide me a great example with sample codings!!! may I please get similar to the example but with diffrent functions? or even better coding!!

Explanation / Answer

It is the another way to define mean functionality

% Calculate mean
mn = 0;
for i = 1:n
  mn = mn + eval(str) * w(i);
end
mn = mn ./ sum(w);