solve linear differential equation
Show older comments
Hey everybody, I am trying to solve a linear differential equation where the right side depends on some function f{1} at some point (x+d,p), whose variables are x and p. Now f{2} should save the solution of this differential equation which should of course be a function depending on x and p. Unfortunately I get the error "Error in derive_p (line 16) eqn = diff(v, x) + lambda*v == lambda*beta+f{1}(x)"
What am I doing wrong?
function opt_barrier = deriv_p(beta, lambda, d)
f=cell(5);
f{1} = @(x,p) (beta*(beta + lambda*(d+(beta-1)*p)-2))/((1-beta)*lambda)+beta*x - ((1-beta)/lambda) *exp(lambda*p-lambda*x);
syms v(x)
eqn = diff(v, x) + lambda*v == lambda*beta+f{1}(x+d,p)
f{2}=dsolve(eqn);
end
Furthermore, the constant which is part of the solution to the diff.equ. should be calculated in a next step. It is the solution to f{1}(x,p)=f{2}(x,p). Does anyone know how to do this?
Thanks in advance:-)
Answers (0)
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!