Math Help Forum

Math Help Forum Feed Site Feed

Go Back   Math Help Forum > Math Resources > Mathematics Software Discussion
Reply
 
Thread Tools Display Modes
  #1  
Old October 7th, 2009, 07:58 AM
Newbie
 
Join Date: Apr 2009
Posts: 14
Country:
Thanks: 1
Thanked 0 Times in 0 Posts
Hikari Clover is on a distinguished road
Default matlab question.need help :(

the initial number of kangaroo is 40, the population of kangaroo decays with a decay rate of p per week

a)write a program to compute the number of kangaroo remaining after 1 week , 2 week and so on up tp 52 weeks, based on p = 0.02,
should treat this as a simulation and not as a theoretical calculation.
present the data as a bar plot

b)modify the code from a) to plot the number of remaining kangaroo as circles, superimpose on this data the analytic result
N(t) = N *e^(-p*t)
N(t)---number of remaining at time t
N------initial number
p------decay constant

c)modify the program from a) to compute the time required for half kangaroo to be dead

d)enclose ur program from c)in a loop to run many realisations, this will enable u to obtain a statistically useful value of t.

----------------------------------------------------------------------

here is my code

a)
p = 0.02;
I = 40;
t = 0:52;
R = round(I*(1-0.02).^t);
bar(t,R)

wtf is simulation but not theoretical calculation???how am i supposed to simulate it?

b)
N0 = 40;
p = 0.02;
t = 0:52;
N = round(N0*exp(-p*t));
plot(t,N,'o')
hold on
bar(t,R)

what should i pick for p(decay constant)? can i use the same p from a) or make 1 up? otherwise how can i solve it?

c)
p = 0.02;
I = 40;
t = 0;
R = 40;
while R >= 20
t=t+1;
R = round(I*(1-0.02).^t);
disp([t R])
end

dont have much problems with this part

d)
have no ideas at all!!!no matter how many time i tried, it gave me the same solution.or am i missing something?
what is the "loop" in the question supposed to be? for loop? while loop?


thank you
Reply With Quote
Advertisement
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -7. The time now is 04:39 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.
©2005 - 2009 Math Help Forum


Math Help Forum is a community of maths forums with an emphasis on maths help in all levels of mathematics.
Register to post your math questions or just hang out and try some of our math games or visit the arcade.