From: Jason Bonior on 17 Jun 2010 12:32 Does anyone know if there is a function in Matlab which can take a function and determine what the value of the input variable was based on the output of the function? A simple example: y = 4*t^2 detemine t given y = 36 All I need is a numeric value, I am not interested in a symbolic solution. I am working with a funciton of multiple gamma functions so it is not easy for me to rearrange the equation to use interp1. Thanks
From: Matt Fig on 17 Jun 2010 12:39 y = @(t) 4*t.^2 fzero(@(t) y(t)-36,5)
From: the cyclist on 17 Jun 2010 12:55 "Matt Fig" <spamanon(a)yahoo.com> wrote in message <hvdj39$pnl$1(a)fred.mathworks.com>... > y = @(t) 4*t.^2 > fzero(@(t) y(t)-36,5) Jason, Matt's reply is spot-on correct, but I can see how you might be perplexed by it, if you have never used certain elements of MATLAB. If you have never heard of "function handles" (using "@"), you should look that up in the documentation. You might want read "doc fzero" as well, for the syntax of that command. (That will explain why the rather out-of-place value of 5 is in there, and how Matt's answer found the positive root rather than the negative root of your equation.) the cyclist
From: Jason Bonior on 17 Jun 2010 12:56 On Jun 17, 12:39 pm, "Matt Fig" <spama...(a)yahoo.com> wrote: > y = @(t) 4*t.^2 > fzero(@(t) y(t)-36,5) I apologize but it seems I was not clear. Forget my simple example, my actual problem is: P = gammainc(N/2, x) / gamma(N/2) N is an integer and x is my variable. I am looking for a way to find the corresponding value of x given a desired value of P. For example what value of x will give me P=0.9?
From: Jason Bonior on 17 Jun 2010 13:03 Looks like I replied too soon. I thought Matt was only answering my simple problem lol. I have been reading the doc fzero and now understand what you are getting at. Thanks a lot guys!
|
Next
|
Last
Pages: 1 2 Prev: integration of a vecotr with quad/quadgk Next: real time video display problem..help?! |