Asked by Karel
on 27 Jul 2012

As part of a University project, I have to program a function that gives me a number that is "the sub-multiplier of y2(xi)-y1(xi) closest to h, while stil beeing inferior or equal to h"

I have y2(xi), y1(xi) and h, but I have no idea how to program this opération. Any help?

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn moreOpportunities for recent engineering grads.

Apply Today
## 4 Comments

## Miro (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/44684#comment_91877

check out FMINSEARCH

## Karel (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/44684#comment_91880

It doesn't help me: I need an answer clsoe to a numerical valor, and fminsearch will only give me the lowest possible answer

## Muruganandham Subramanian (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/44684#comment_91882

Hi,

check this link

http://www.mathworks.com/matlabcentral/fileexchange/15088-search-closest-value-in-a-vector

## Karel (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/44684#comment_91884

Thank you, that's part of the solution I need. But how do i create a vector of sub-multipliers?