I have two different Matlab function files which compute both a quantity with an integral by use of the trapezodial rule. Now, I would like to solve the following equation for $\lambda,a,b$:


Does anyone know a way to solve this by use of Matlab? So I'm looking for a function in Matlab that can solve the equation of two function files. Hopefully anyone can help me out!


It's been a while since I used MATLAB, but it should be possible with the fnzeros function. Your equation is equivalent to $$\mathrm{quantity1}(\lambda,a,b)-\mathrm{quantity2}(\lambda,a,b) = 0 $$

Hence, define a function (with inputs $\lambda$, $a$, $b$) that is the difference between your two existing functions, and then use the fnzeros function to find the zeros.

  • $\begingroup$ That's right...but be aware that you'll only get a numerical approximation to the location of the zeroes. $\endgroup$ – John Hughes Jun 15 '18 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.