Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

p=malt(p0,r,n) p=zeros(n+1,1); p(1)=p0; for i=1:n p(i+1)=(1+r)*p(i); end I wrote this program (in matlab) to find the population of the US and it works good, where

p=malt(p0,r,n) p=zeros(n+1,1); p(1)=p0; for i=1:n p(i+1)=(1+r)*p(i); end 

I wrote this program (in matlab) to find the population of the US and it works good, where ( p0=initial population, r=annual growth rate, n=years). I want to modify the code using while loop to be able to find how long till the population doubled from a certain year.

i tried this but is not working:

g = popdouble(p0,r) p{1}=p0; i = 1; while (p{i} 

%need help with my coding

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

1. Describe the factors that lead to productive conflict

Answered: 1 week ago