[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ode45 issue: dimension mismatch
From: |
Sebastian Schöps |
Subject: |
Re: ode45 issue: dimension mismatch |
Date: |
Wed, 7 Feb 2018 01:31:08 -0700 (MST) |
Tweetman wrote
> Hello, sorry for the confusion. Yes, what I meant was
> dx/dt = M*(x^m)*(1-x)^n
If the initial value is x(0)=0 then your ODE will only have the trivial
solution x=0.
Tweetman wrote
> clear; clc;
> t = linspace(0,400,101);
> 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);
* I suggest to use a anonymous function, see
https://www.gnu.org/software/octave/doc/v4.2.0/Anonymous-Functions.html
* Your initial value as two components but it is a scalar ode
Try this:
t = linspace(0,400,101);
x0 = 0;
M = 2.933e-5;
m = 0.158;
n = 1.26;
dx = @(t,x) ( M*(x.^m)*(1-x).^n );
[t,x] = ode45(dx, t, x0);
plot(t,x)
and enjoy the zero function :)
Seb.
--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
- ode45 issue: dimension mismatch, Tweety, 2018/02/06
- Re: ode45 issue: dimension mismatch, Carlo De Falco, 2018/02/06
- Re: ode45 issue: dimension mismatch, Tweety, 2018/02/06
- Re: ode45 issue: dimension mismatch, Sergei Steshenko, 2018/02/06
- Re: ode45 issue: dimension mismatch, Svetlana Tkachenko, 2018/02/07
- Re: ode45 issue: dimension mismatch, Thomas D. Dean, 2018/02/07
- Re: ode45 issue: dimension mismatch, Tweety, 2018/02/07
- Re: ode45 issue: dimension mismatch,
Sebastian Schöps <=
- Re: ode45 issue: dimension mismatch, Carlo De Falco, 2018/02/07
- Re: ode45 issue: dimension mismatch, gciriani, 2018/02/07