How to "solve" a "function"

조회 수: 10 (최근 30일)
Tiancong
Tiancong 2014년 1월 21일
댓글: Amit 2014년 1월 21일
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?
  댓글 수: 1
Tiancong
Tiancong 2014년 1월 21일
Sorry, I think I didn't give a good example. Could you help me on my real problems pleases? Thank you so much! Here is the link:

댓글을 달려면 로그인하십시오.

채택된 답변

Amit
Amit 2014년 1월 21일
The issue here is that you cannot reverse engineer this kind of function. If you know the average and lets say you know the size of the vector that gave the average, still can not determine the vector by any method or algorithm using any program in the world.
you can understand it like this: Lets say the average is 10 and size of vector is 2. then possible solutions will be [0 20],[9 11], [10 10] and many many many more. You can never figure out (unless you have some other information) which was the original vector that gave you the average of 10.
  댓글 수: 2
Tiancong
Tiancong 2014년 1월 21일
Sorry, I think I didn't give a good example. Could you help me on my real problems pleases? Thank you so much! Here is the link:
Amit
Amit 2014년 1월 21일
Answered there already.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by