a problem with ODE and a for loop

I have a problem where dx/dt = u(x) * x
where u(x) = integral (cos(phi) - exp ( 5*x*cos(phi) ) ) d phi where phi changes from 0 to 2*pi
I tried to build a function file with an inner for loop but I have problems with that
any help with this problem

2 Comments

Please show us what you have tried and explain the occurring problems with all necessary details. We cannot help to solve your problem, when we have to guess the problem at first.
I am trying to solve an ODE with matlab PDE toolbox (although I realize that this is not a good way to do, since there is a lot way to solve a ODE without using pde toolbox). I am trying to understand how to specify a derivative in PDE specification equation.
Suppose I want to solve an ODE : y'' + y' + y = 0. and the BC is y(0) = 5, and y(1) = -0.2.
I drew a rectangular, with length 1, and arbitrary height. The boundary specification that I used is: left boundary = Dirichlet, h = 1, r = 5, right boundary = Dirichlet, h = 1, r = -0.2. up and bottom = Neumann, g = q = 0.
(PDE Specification) Elliptic, c=-1, a=1, f = -ux (I want to specify a du/dx here).
When I drew mesh and solve I got this error: "Expression evaluates to wrong size. Must be scalar or wrong vector. In a system case, pass first or second row, for example, u(2,:). In expression: -ux. when evaluating pde coefficient."
I want to ask how can I specify a derivative term in PDE toolbox pde coefficient?
Thanks

Sign in to comment.

Answers (0)

Asked:

on 9 Nov 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!