Hi, Thanks for the reply. Basically, the equation I am trying to solve is
time. M=2.93e-5 is a pre factor, m=0.158 and n=1.26 are exponents which
describe the order of the two parts of a reaction.
same issue... no.
Am 06.02.2018 um 15:52 schrieb Carlo De Falco:
> Hi,
>
>> On 6 Feb 2018, at 12:07, Tweety <
address@hidden> wrote:
>>
>> Dear all,
>>
>> For my first time, I am trying to solve a differential equation using
>> ode45. My code looks like this:
>>
>> clear; clc;
>> t = linspace(0,400,401);
>> x0 = [0, 0];
>> function f = dx(x,t)
>> M = 2.933e-5;
>> m = 0.158;
>> n = 1.26;
>> dx = M*x^m(1-x)^n;
>> endfunction
>> [t,x] = ode45(@dx, t, x0);
>>
>> The error I get is a dimension mismatch and I do not understand a
>> mismatch between which parameters.
>>
>> Can this function be solved by ode45 at all or should I use a different
>> solver or bring the function to a different form? If so, which? I
>> appreciate any kind of information.
>
> There are so many errors in the few lines of code above that it is quite
> difficult to understand what actually is the proble that you are trying to
> solve, maybe it would be easier to understand what you are trying to accomplish
> if you write in formulas rather than in code.
>
> Is this some sort of homework?
>
> We usually don't solve homework questions on this list, but we do answer specific
> questions about the usage of octave functions.
>
>> Thanks,
>> Jan
>
> c.
>
>
-----------------------------------------
Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018. More info:
https://wiki.octave.org/OctConf_2018-----------------------------------------
On the surface, purely mathematically,
dx = M*x^m(1-x)^n;
looks wrong.
You probably meant
dx = M*x^m * (1-x)^n;
.
I've added '*' op sign between 'm' and the following '('. As a general rule of thumb surround op signs with spaces. I.e. do not write
a+b
, rather write
a + b
.
I.e. judging by your reply I presume 'm' is constant - not a function. The original "m(1-x)" - looks like a function call or like extraction of component with index of 1-x from vector m.
--Sergei.