finding the nullclines of a two connected ODE's











up vote
0
down vote

favorite












so I've given the following problem:



$dn_1/dt=N(t)n_1-n_1$



$dn_2/dt=N(t)n_2-4n_2$



$N(t)=25-6n_1-3n_2$



so I've found the fixed points of the 2 equations and got:
[(0,0),(0,7),(4,0)]



now I want to find the nullclines of them:



so for $dn_1/dt=0$ we get $n_1(24-6n_1-3n_2)$ which means:




  1. $n_1=0$ for all $n_2$


  2. $n_1=4-0.5n_2$



so for $dn_2/dt=0$ we get $n_2(21-6n_1-3n_2)$ which means:




  1. $n_2=0$ for all $n_1$


  2. $n_2=7-2n_1$



plotting the following using matlab in order to find the phase plane and basin of attraction gives peculiar results which I can't find to be able to understand. (fig attached below)
I thought the the 3 nullcline need to be intersecting both the fixed points which is more intuitive to me but instead I get the following.



enter image description here



the Matlab code generating this plot is as follows:



clear, close all; clc
%Const
N0=25;
G1=1;G2=1;
a1=6;a2=3;
k1=1;k2=4;
%Params
t0 = 0; % starting time
dt = 0.5; % step size
tEnd = 50; % end time
timeVec=t0:dt:tEnd;
NumSteps=floor(tEnd./dt);
%Function Handlers
N_t=@(n1,n2) N0-a1.*n1-a2.*n2;
n1_dot=@(n1,n2) G1.*N_t(n1,n2).*n1-k1.*n1;
n2_dot=@(n1,n2) G2.*N_t(n1,n2).*n2-k2.*n2;

%%finding the fixed point's
%%%%%%%%%
system=@(n1,n2) [n1_dot(n1,n2);n2_dot(n1,n2)];
s = solve(system);
%%%%%%%%%

%TODO RECHECK!!!!
%%nulclines
%%%%%%%%%
%n1_dot=0
%case 1: n1 = 0
%case 2: n1 != 0

%n2_dot=0
%case 1: n2 = 0
%case 2: n2 != 0

%%%%%%%%%
ptsMesh=-10:0.2:25;
figure
[X,Y]=meshgrid(ptsMesh);
U=n1_dot(X,Y);
V=n2_dot(X,Y);
normalizedFactor=sqrt(U.^2+V.^2);
quiver(X,Y,U./normalizedFactor,V./normalizedFactor,1,'b')
hold on
plot(s.n1,s.n2,'k*','lineWidth',8)
%plot the trivial nullclines on the axis
[x,y]=size(ptsMesh);
nullclineN1_zero=[0,min(ptsMesh);0,max(ptsMesh)];
nullclineN2_zero=[min(ptsMesh),0;max(ptsMesh),0];
plot(nullclineN2_zero(:,1),nullclineN2_zero(:,2),'g','lineWidth',2);
plot(nullclineN1_zero(:,1),nullclineN1_zero(:,2),'r','lineWidth',2);

t1=@(x2) 4-(0.5).*x2;
res1=t1(ptsMesh);
plot(res1,ptsMesh,'c','lineWidth',2);


t2=@(x1) 7-(2).*x1;
res2=t2(ptsMesh);
plot(ptsMesh,res2,'k','lineWidth',2);


will appreciate some help here
thanks










share|cite|improve this question




























    up vote
    0
    down vote

    favorite












    so I've given the following problem:



    $dn_1/dt=N(t)n_1-n_1$



    $dn_2/dt=N(t)n_2-4n_2$



    $N(t)=25-6n_1-3n_2$



    so I've found the fixed points of the 2 equations and got:
    [(0,0),(0,7),(4,0)]



    now I want to find the nullclines of them:



    so for $dn_1/dt=0$ we get $n_1(24-6n_1-3n_2)$ which means:




    1. $n_1=0$ for all $n_2$


    2. $n_1=4-0.5n_2$



    so for $dn_2/dt=0$ we get $n_2(21-6n_1-3n_2)$ which means:




    1. $n_2=0$ for all $n_1$


    2. $n_2=7-2n_1$



    plotting the following using matlab in order to find the phase plane and basin of attraction gives peculiar results which I can't find to be able to understand. (fig attached below)
    I thought the the 3 nullcline need to be intersecting both the fixed points which is more intuitive to me but instead I get the following.



    enter image description here



    the Matlab code generating this plot is as follows:



    clear, close all; clc
    %Const
    N0=25;
    G1=1;G2=1;
    a1=6;a2=3;
    k1=1;k2=4;
    %Params
    t0 = 0; % starting time
    dt = 0.5; % step size
    tEnd = 50; % end time
    timeVec=t0:dt:tEnd;
    NumSteps=floor(tEnd./dt);
    %Function Handlers
    N_t=@(n1,n2) N0-a1.*n1-a2.*n2;
    n1_dot=@(n1,n2) G1.*N_t(n1,n2).*n1-k1.*n1;
    n2_dot=@(n1,n2) G2.*N_t(n1,n2).*n2-k2.*n2;

    %%finding the fixed point's
    %%%%%%%%%
    system=@(n1,n2) [n1_dot(n1,n2);n2_dot(n1,n2)];
    s = solve(system);
    %%%%%%%%%

    %TODO RECHECK!!!!
    %%nulclines
    %%%%%%%%%
    %n1_dot=0
    %case 1: n1 = 0
    %case 2: n1 != 0

    %n2_dot=0
    %case 1: n2 = 0
    %case 2: n2 != 0

    %%%%%%%%%
    ptsMesh=-10:0.2:25;
    figure
    [X,Y]=meshgrid(ptsMesh);
    U=n1_dot(X,Y);
    V=n2_dot(X,Y);
    normalizedFactor=sqrt(U.^2+V.^2);
    quiver(X,Y,U./normalizedFactor,V./normalizedFactor,1,'b')
    hold on
    plot(s.n1,s.n2,'k*','lineWidth',8)
    %plot the trivial nullclines on the axis
    [x,y]=size(ptsMesh);
    nullclineN1_zero=[0,min(ptsMesh);0,max(ptsMesh)];
    nullclineN2_zero=[min(ptsMesh),0;max(ptsMesh),0];
    plot(nullclineN2_zero(:,1),nullclineN2_zero(:,2),'g','lineWidth',2);
    plot(nullclineN1_zero(:,1),nullclineN1_zero(:,2),'r','lineWidth',2);

    t1=@(x2) 4-(0.5).*x2;
    res1=t1(ptsMesh);
    plot(res1,ptsMesh,'c','lineWidth',2);


    t2=@(x1) 7-(2).*x1;
    res2=t2(ptsMesh);
    plot(ptsMesh,res2,'k','lineWidth',2);


    will appreciate some help here
    thanks










    share|cite|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      so I've given the following problem:



      $dn_1/dt=N(t)n_1-n_1$



      $dn_2/dt=N(t)n_2-4n_2$



      $N(t)=25-6n_1-3n_2$



      so I've found the fixed points of the 2 equations and got:
      [(0,0),(0,7),(4,0)]



      now I want to find the nullclines of them:



      so for $dn_1/dt=0$ we get $n_1(24-6n_1-3n_2)$ which means:




      1. $n_1=0$ for all $n_2$


      2. $n_1=4-0.5n_2$



      so for $dn_2/dt=0$ we get $n_2(21-6n_1-3n_2)$ which means:




      1. $n_2=0$ for all $n_1$


      2. $n_2=7-2n_1$



      plotting the following using matlab in order to find the phase plane and basin of attraction gives peculiar results which I can't find to be able to understand. (fig attached below)
      I thought the the 3 nullcline need to be intersecting both the fixed points which is more intuitive to me but instead I get the following.



      enter image description here



      the Matlab code generating this plot is as follows:



      clear, close all; clc
      %Const
      N0=25;
      G1=1;G2=1;
      a1=6;a2=3;
      k1=1;k2=4;
      %Params
      t0 = 0; % starting time
      dt = 0.5; % step size
      tEnd = 50; % end time
      timeVec=t0:dt:tEnd;
      NumSteps=floor(tEnd./dt);
      %Function Handlers
      N_t=@(n1,n2) N0-a1.*n1-a2.*n2;
      n1_dot=@(n1,n2) G1.*N_t(n1,n2).*n1-k1.*n1;
      n2_dot=@(n1,n2) G2.*N_t(n1,n2).*n2-k2.*n2;

      %%finding the fixed point's
      %%%%%%%%%
      system=@(n1,n2) [n1_dot(n1,n2);n2_dot(n1,n2)];
      s = solve(system);
      %%%%%%%%%

      %TODO RECHECK!!!!
      %%nulclines
      %%%%%%%%%
      %n1_dot=0
      %case 1: n1 = 0
      %case 2: n1 != 0

      %n2_dot=0
      %case 1: n2 = 0
      %case 2: n2 != 0

      %%%%%%%%%
      ptsMesh=-10:0.2:25;
      figure
      [X,Y]=meshgrid(ptsMesh);
      U=n1_dot(X,Y);
      V=n2_dot(X,Y);
      normalizedFactor=sqrt(U.^2+V.^2);
      quiver(X,Y,U./normalizedFactor,V./normalizedFactor,1,'b')
      hold on
      plot(s.n1,s.n2,'k*','lineWidth',8)
      %plot the trivial nullclines on the axis
      [x,y]=size(ptsMesh);
      nullclineN1_zero=[0,min(ptsMesh);0,max(ptsMesh)];
      nullclineN2_zero=[min(ptsMesh),0;max(ptsMesh),0];
      plot(nullclineN2_zero(:,1),nullclineN2_zero(:,2),'g','lineWidth',2);
      plot(nullclineN1_zero(:,1),nullclineN1_zero(:,2),'r','lineWidth',2);

      t1=@(x2) 4-(0.5).*x2;
      res1=t1(ptsMesh);
      plot(res1,ptsMesh,'c','lineWidth',2);


      t2=@(x1) 7-(2).*x1;
      res2=t2(ptsMesh);
      plot(ptsMesh,res2,'k','lineWidth',2);


      will appreciate some help here
      thanks










      share|cite|improve this question















      so I've given the following problem:



      $dn_1/dt=N(t)n_1-n_1$



      $dn_2/dt=N(t)n_2-4n_2$



      $N(t)=25-6n_1-3n_2$



      so I've found the fixed points of the 2 equations and got:
      [(0,0),(0,7),(4,0)]



      now I want to find the nullclines of them:



      so for $dn_1/dt=0$ we get $n_1(24-6n_1-3n_2)$ which means:




      1. $n_1=0$ for all $n_2$


      2. $n_1=4-0.5n_2$



      so for $dn_2/dt=0$ we get $n_2(21-6n_1-3n_2)$ which means:




      1. $n_2=0$ for all $n_1$


      2. $n_2=7-2n_1$



      plotting the following using matlab in order to find the phase plane and basin of attraction gives peculiar results which I can't find to be able to understand. (fig attached below)
      I thought the the 3 nullcline need to be intersecting both the fixed points which is more intuitive to me but instead I get the following.



      enter image description here



      the Matlab code generating this plot is as follows:



      clear, close all; clc
      %Const
      N0=25;
      G1=1;G2=1;
      a1=6;a2=3;
      k1=1;k2=4;
      %Params
      t0 = 0; % starting time
      dt = 0.5; % step size
      tEnd = 50; % end time
      timeVec=t0:dt:tEnd;
      NumSteps=floor(tEnd./dt);
      %Function Handlers
      N_t=@(n1,n2) N0-a1.*n1-a2.*n2;
      n1_dot=@(n1,n2) G1.*N_t(n1,n2).*n1-k1.*n1;
      n2_dot=@(n1,n2) G2.*N_t(n1,n2).*n2-k2.*n2;

      %%finding the fixed point's
      %%%%%%%%%
      system=@(n1,n2) [n1_dot(n1,n2);n2_dot(n1,n2)];
      s = solve(system);
      %%%%%%%%%

      %TODO RECHECK!!!!
      %%nulclines
      %%%%%%%%%
      %n1_dot=0
      %case 1: n1 = 0
      %case 2: n1 != 0

      %n2_dot=0
      %case 1: n2 = 0
      %case 2: n2 != 0

      %%%%%%%%%
      ptsMesh=-10:0.2:25;
      figure
      [X,Y]=meshgrid(ptsMesh);
      U=n1_dot(X,Y);
      V=n2_dot(X,Y);
      normalizedFactor=sqrt(U.^2+V.^2);
      quiver(X,Y,U./normalizedFactor,V./normalizedFactor,1,'b')
      hold on
      plot(s.n1,s.n2,'k*','lineWidth',8)
      %plot the trivial nullclines on the axis
      [x,y]=size(ptsMesh);
      nullclineN1_zero=[0,min(ptsMesh);0,max(ptsMesh)];
      nullclineN2_zero=[min(ptsMesh),0;max(ptsMesh),0];
      plot(nullclineN2_zero(:,1),nullclineN2_zero(:,2),'g','lineWidth',2);
      plot(nullclineN1_zero(:,1),nullclineN1_zero(:,2),'r','lineWidth',2);

      t1=@(x2) 4-(0.5).*x2;
      res1=t1(ptsMesh);
      plot(res1,ptsMesh,'c','lineWidth',2);


      t2=@(x1) 7-(2).*x1;
      res2=t2(ptsMesh);
      plot(ptsMesh,res2,'k','lineWidth',2);


      will appreciate some help here
      thanks







      mathematical-modeling stability-in-odes






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Nov 14 at 18:57

























      asked Nov 14 at 17:53









      chemist

      143




      143



























          active

          oldest

          votes











          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "69"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2998593%2ffinding-the-nullclines-of-a-two-connected-odes%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2998593%2ffinding-the-nullclines-of-a-two-connected-odes%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to change which sound is reproduced for terminal bell?

          Can I use Tabulator js library in my java Spring + Thymeleaf project?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents