Introducing new populations in mathematica graphs

  • Mathematica
  • Thread starter pemb09
  • Start date
  • #1
2
0
hi i was wondering if anyone knew how to introduce different populations at diffrent times on the same plot on mathematica?
Say i wanted population 1 have n = 10 at t=0, population 2 to have n=4 at t=0 and then introduce a new population at t=25 so that population 3 would have n= 0 initally but then n= 1 at t = 25.
Any ideas? the only way I've been gettting around it is to give population 3 really small values initially (e.g. 0.000000000001) but its not very precise.
 

Answers and Replies

  • #2
Dale
Mentor
Insights Author
2020 Award
30,675
7,245
What kind of plot are you using? If you are using list plot then you can specify both x and y coordinates in your list. e.g.

a = Transpose[{Range[10], 2 Range[10]}];
b = Table[{x, 13}, {x, 3, 10}];
ListPlot[{a, b}]
 
  • #3
2
0
I'm using Plot [ndsolve] of a set of differential equations. Listplot won't seem to make a list of solutions. I want one populations to have initial conditions of 0 but then at a further time stage to have a vlaue of 1 and see how that changes.
 
  • #4
Dale
Mentor
Insights Author
2020 Award
30,675
7,245
If popa and popb are the InterpolatingFunction objects that return from NDSolve then you can do the following:


truncate[f_InterpolatingFunction, t_] := If[f[[1, 1, 1]] <= t <= f[[1, 1, 2]], f[t]];
Plot[{truncate[popa, t], truncate[popb, t]}, {t, -1, 6}]
 

Related Threads on Introducing new populations in mathematica graphs

  • Last Post
Replies
3
Views
4K
Replies
1
Views
2K
Replies
3
Views
9K
Replies
0
Views
2K
Replies
1
Views
4K
Replies
1
Views
4K
Replies
4
Views
4K
Replies
2
Views
916
Replies
5
Views
5K
Replies
5
Views
7K
Top