Lets take the "function" example from MATLAB website:
________________
Define a function in a file named average.m that accepts an input vector, calculates the average of the values, and returns a single result.
function y = average(x)
if ~isvector(x)
error('Input must be a vector')
end
y = sum(x)/length(x);
end
Call the function from the command line.
z = 1:99;
average(z)
ans = 50
_________________
This function can give us the average. If we know the average, how could we use "solve" to find out the initial inputs?
Best Answer