Re: [R] R and MatLab implementations of the same model differs

2013-07-05 Thread Jannetta Steyn
Aah. Thanks. I remember someone mentioned a named vector and I meant to ask what that was, but I forgot. I have now fixed it. On 5 July 2013 17:18, Berend Hasselman wrote: > > On 05-07-2013, at 17:37, Jannetta Steyn wrote: > > > Thank you very much to all of you for your help. This model now

Re: [R] R and MatLab implementations of the same model differs

2013-07-05 Thread Berend Hasselman
On 05-07-2013, at 17:37, Jannetta Steyn wrote: > Thank you very much to all of you for your help. This model now works as it > should (I believe). This is the final code: > > rm(list=ls()) > > library(deSolve) > > ST <- function(time, init, parms) { > with(as.list(c(init, parms)),{ > >

Re: [R] R and MatLab implementations of the same model differs

2013-07-05 Thread Jannetta Steyn
Thank you very much to all of you for your help. This model now works as it should (I believe). This is the final code: rm(list=ls()) library(deSolve) ST <- function(time, init, parms) { with(as.list(c(init, parms)),{ #functions to calculate activation m and inactivation h of the current

Re: [R] R and MatLab implementations of the same model differs

2013-07-05 Thread Jannetta Steyn
On 5 July 2013 09:44, Berend Hasselman wrote: > > On 05-07-2013, at 09:53, Jannetta Steyn wrote: > > > > > > > > > > > I don't quite know how to explain the "doesn't work" in more detail > without > > > any visual aid. > > > > You said that R got into an indefinite loop, whatever that maybe. > >

Re: [R] R and MatLab implementations of the same model differs

2013-07-05 Thread Berend Hasselman
On 05-07-2013, at 09:53, Jannetta Steyn wrote: > > > > > > I don't quite know how to explain the "doesn't work" in more detail without > > any visual aid. > > You said that R got into an indefinite loop, whatever that maybe. > > > > When I change the solver to ode45 the script never stops r

Re: [R] R and MatLab implementations of the same model differs

2013-07-04 Thread peter dalgaard
On Jul 5, 2013, at 00:41 , Jannetta Steyn wrote: > Hi All > > Thanks for all the comments. I have looked at everything you have pointed > out and this is the situation at the moment: > >> I don't think so. >> In the R script you have >> >> init = c(v_axon_AB=-55,mNa_axon_AB=1,hNa_axon_AB=0,mK_

Re: [R] R and MatLab implementations of the same model differs

2013-07-04 Thread Jannetta Steyn
Hi All Thanks for all the comments. I have looked at everything you have pointed out and this is the situation at the moment: > I don't think so. > In the R script you have > > init = c(v_axon_AB=-55,mNa_axon_AB=1,hNa_axon_AB=0,mK_axon_AB=1) > > That is not the same as in your Matlab script. To m

Re: [R] R and MatLab implementations of the same model differs

2013-07-04 Thread peter dalgaard
On Jul 4, 2013, at 20:14 , Berend Hasselman wrote: > > On 04-07-2013, at 19:56, peter dalgaard wrote: > >> >> On Jul 4, 2013, at 19:11 , Berend Hasselman wrote: >> >>> >>> On 04-07-2013, at 18:42, Jannetta Steyn wrote: >>> Hi Ben and others I don't quite know how to explai

Re: [R] R and MatLab implementations of the same model differs

2013-07-04 Thread Berend Hasselman
On 04-07-2013, at 19:56, peter dalgaard wrote: > > On Jul 4, 2013, at 19:11 , Berend Hasselman wrote: > >> >> On 04-07-2013, at 18:42, Jannetta Steyn wrote: >> >>> Hi Ben and others >>> >>> I don't quite know how to explain the "doesn't work" in more detail without >>> any visual aid. >>

Re: [R] R and MatLab implementations of the same model differs

2013-07-04 Thread peter dalgaard
On Jul 4, 2013, at 19:11 , Berend Hasselman wrote: > > On 04-07-2013, at 18:42, Jannetta Steyn wrote: > >> Hi Ben and others >> >> I don't quite know how to explain the "doesn't work" in more detail without >> any visual aid. > > You said that R got into an indefinite loop, whatever that may

Re: [R] R and MatLab implementations of the same model differs

2013-07-04 Thread Berend Hasselman
On 04-07-2013, at 18:42, Jannetta Steyn wrote: > Hi Ben and others > > I don't quite know how to explain the "doesn't work" in more detail without > any visual aid. You said that R got into an indefinite loop, whatever that maybe. > When you run the two scripts it is easy to see the > differe

Re: [R] R and MatLab implementations of the same model differs

2013-07-04 Thread Jannetta Steyn
Hi Ben and others I don't quite know how to explain the "doesn't work" in more detail without any visual aid. When you run the two scripts it is easy to see the difference. MatLab produces a line on x= -55. This is what I expect - a more or less straight line. R on the other hand the result drops

Re: [R] R and MatLab implementations of the same model differs

2013-07-04 Thread Ben Bolker
Berend Hasselman xs4all.nl> writes: > > > On 04-07-2013, at 17:15, Jannetta Steyn henning.org> wrote: > > > Hi folks > > > > I have implemented a model of a neuron using Hodgkin Huxley equations in > > both R and MatLab. My preference is to work with R but R is not giving me > > the correct

Re: [R] R and MatLab implementations of the same model differs

2013-07-04 Thread Berend Hasselman
On 04-07-2013, at 17:15, Jannetta Steyn wrote: > Hi folks > > I have implemented a model of a neuron using Hodgkin Huxley equations in > both R and MatLab. My preference is to work with R but R is not giving me > the correct results. I also can't use ode45 as it just seems to go into an > indef

[R] R and MatLab implementations of the same model differs

2013-07-04 Thread Jannetta Steyn
Hi folks I have implemented a model of a neuron using Hodgkin Huxley equations in both R and MatLab. My preference is to work with R but R is not giving me the correct results. I also can't use ode45 as it just seems to go into an indefinite loop. However, the MatLab implementation work fine with