Question

In: Advanced Math

In the study of population dynamics one of the most famous models for a growing but...

In the study of population dynamics one of the most famous models for a growing but bounded population is the logistic equation dP/dt = P(a − bP), where a and b are positive constants. First find the general solution, then given a particular solution with p(0)=1. Then plot the solution in MATLAB with two sets of (a,b) values that you choose.

Solutions

Expert Solution


clear all
close all
%exact soultion
syms p(t) a b
eqn = diff(p,t) == p.*(a-b.*p);
cond = p(0) == 1;
Psol(t) = dsolve(eqn,cond);
fprintf('General Exact solution for given ode P(t)=')
disp(Psol)


%exact soultion
syms p(t)
eqn = diff(p,t) == p.*(10-5.*p);
cond = p(0) == 1;
Psol(t) = dsolve(eqn,cond);
fprintf('Exact solution for given ode for a=10; b=5 P(t)=')
disp(Psol)


%function for which Euler method have to calculate
a=10; b=5;
f=@(t,P) P.*(a-b*P);
P_in=1; t_in=0; t_end=2;
h=0.01;
[t_result,P_result] = euler_method(f,P_in,t_in,t_end,h);
figure(1)
hold on
plot(t_result,P_result)
plot(t_result,Psol(t_result))
xlabel('time')
ylabel('P(t)')
title('P(t) vs. t plot a=10 b=5')
legend('Euler Solution','Exact Solution')
box on

%exact soultion
syms p(t)
eqn = diff(p,t) == p.*(15-3.*p);
cond = p(0) == 1;
Psol(t) = dsolve(eqn,cond);
fprintf('Exact solution for given ode for a=15; b=3 P(t)=')
disp(Psol)


%function for which Euler method have to calculate
a=15; b=3;
f=@(t,P) P.*(a-b*P);
P_in=1; t_in=0; t_end=2;
h=0.01;
[t_result,P_result] = euler_method(f,P_in,t_in,t_end,h);
figure(2)
hold on
plot(t_result,P_result)
plot(t_result,Psol(t_result))
xlabel('time')
ylabel('P(t)')
title('P(t) vs. t plot a=15 b=3')
legend('Euler Solution','Exact Solution')
box on

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Matlab code for Euler's forward
function [t_result,y1_result] = euler_method(f,y0,t0,tend,h)
%function for Euler equation solution
  
    %all step size
    N=(tend-t0)/h;
    %Initial values

    %t end values
    tn=t0:h:tend;
    % Euler steps
    y1_result(1)=y0;
    t_result(1)=t0;
    fprintf('\n\tFor step size %2.2f\n',h)
    for i=1:length(tn)-1
        t_result(i+1)= t_result(i)+h;
        y1_result(i+1)=y1_result(i)+h*double(f(t_result(i),y1_result(i)));
        %fprintf('At x=%2.2f y(%2.2f)=%f\n',t_result(i+1),t_result(i+1),y1_result(i+1))
    end
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


Related Solutions

Entropy is one of the most important and most fundamental concepts in thermal dynamics. It is...
Entropy is one of the most important and most fundamental concepts in thermal dynamics. It is also one of the most frequently misunderstood. In this assignment, you will research entropy and write a 3-5 page informative essay describing what entropy is and how it relates to the 2nd law of Thermodynamics. Your description of entropy should be more than a simple definition; the purpose of the paper is for you to demonstrate your own understanding of this concept and how...
Rachel Carson. Carson’s most famous book, Silent Spring, is often named as one of the most...
Rachel Carson. Carson’s most famous book, Silent Spring, is often named as one of the most important books of the 20th century, and she is frequently called the mother of the modern environmental movement. Yet some question her relevance to today’s environmental debates, and others view her as a divisive or discredited figure. This week, we’ll discuss who Rachel Carson was and how her ideas and viewpoints still resonate in the 21st century. As a freelance writer, I’ve told Carson’s...
Imagine that you are being interviewed with a reporter from one of the most famous business...
Imagine that you are being interviewed with a reporter from one of the most famous business magazines in the world. You are asked about your important memories of your business life. Please write a scenario of your own using the theoretical knowledge that you obtained from this lecture. You can write about anything related to our topics (like building a start-up, managing a successful change, not being able to manage change and failing, making decisions on cooperation with other companies...
IFCs: an overview IFCs are nowadays one of the most dynamics realities of inter- national finance;...
IFCs: an overview IFCs are nowadays one of the most dynamics realities of inter- national finance; according to the IMF’s definition, international Financial Centres (IFCs)—such as London, New York, and Tokyo—are large international full-service centres with advanced settlement and payments systems. They serve multiple purposes, first of all support- ing large domestic economies with deep and liquid markets where both the sources and uses of funds are diverse, and where legal and regulatory frameworks are adequate to safeguard the integrity...
One of the most famous people claiming to be Grand Duchess Anastasia was Anna Anderson, who...
One of the most famous people claiming to be Grand Duchess Anastasia was Anna Anderson, who died in the United States in 1984. What types of DNA analyses were used to verify the true identity of Ms. Anderson, and what were the conclusions from these studies? Begin your search by reading Stoneking, M., et al. 1995. Establishing the identity of Anna Anderson Manahan. Nature Genet. 9: 9–10.
Case study : Marks & Spencer Does M&S have a future? The country’s most famous retailer...
Case study : Marks & Spencer Does M&S have a future? The country’s most famous retailer Marks & Spencer’s big store in London’s Kensington High Street has just had a re-fit. Instead of the usual drab M&S interior, it is now Californian shopping mall meets modernist chrome and creamy marble floors. Roomy walkways and designer displays have replaced dreary row after row of clothes racks. By the end of the year M&S will have 26 such stores around Britain –...
There are different perspectives on human population growth and the dynamics associated with population change. Go...
There are different perspectives on human population growth and the dynamics associated with population change. Go to CIA World Factbook website and one developing country and compare the following and answer the questions: Example of a developed country: China Population growth rate: 0.32 percent year 2020 estimation, rank 170 in the whole world Birth rate: 11.6 births per 1000 people 2020 estimation, rank 168 in the whole world Death rate: 8.2 deaths per 1000 people 2020 estimation, rank 85 in...
Robert Slow was a very influential economist that developed one of the most important models of...
Robert Slow was a very influential economist that developed one of the most important models of economic growth. His main argument is the so-called convergence theory. Review section 20.4 - Economic Convergence and explain what economic convergence is. Briefly describe the arguments both in favor and against this idea of convergence. Which side are you on? Think about the cases of China and South Korea, they were once poor economies but now they are much closer to rich economies. But...
In one famous study (Rosenhan, 1973), eight healthy volunteers (“pseudopatients”) presented themselves to psychiatric hospitals. They...
In one famous study (Rosenhan, 1973), eight healthy volunteers (“pseudopatients”) presented themselves to psychiatric hospitals. They told the admissions officers that they had been hearing voices. Except for this one lie, they answered all other questions truthfully. All pseudopatients were admitted to the hospitals, where they ceased to pretend they were hearing voices (in other words, they behaved ‘normally’). None of the pseudopatients were detected as sane. Rosenhan argued that the staff at the hospitals seemed to be operating under...
There is a famous rapper who had Munchausen's Syndrome growing up as a child. He sings...
There is a famous rapper who had Munchausen's Syndrome growing up as a child. He sings about Munchausen's syndrome in one of his songs. Which rapper is it? What song is it? Tell me his biography and all the psychological trauma he went through. Define Munchausen's Syndrome and Muchausen's by Proxy.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT