[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
fsolve with varying parameters
From: |
John W. Eaton |
Subject: |
fsolve with varying parameters |
Date: |
Thu, 2 Sep 2010 01:03:11 -0400 |
On 1-Sep-2010, jwilley44 wrote:
|
| I have not been able to figure out how use fsolve to solve an equation
| multiple times while varying one parameter. Here is what I mean
|
| P=linspace(0,1,100)
|
| function y=f(x,p)
| y = 1/x + p/(1+x)
| endfunction
|
| for i=1:1000
| fsolve( f(x,P(i)), 1.)
| endfor
|
| I realize the syntax for defining that function may not be correct but I
| hope that it conveys my idea.
Use an anonymous function:
fsolve (@(x) f(x, P(i)), 1)
jwe