Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Flow problem

Subject: Flow problem

From: Brittani

Date: 28 Sep, 2010 19:04:19

Message: 1 of 5

I am trying to figure out how to plot the equation:

dv = dt(10-0.1v)

where v(0) is 200
and the time is from 0:180

solving the equation, I get:

v(1) - v(0) = dt ( 10 - 0.1 * v(0) )

therefore,

v(1) = v(0) + dt ( 10 - 0.1 * V(0) )

how can I make it show the amount of v in the tank at each minute t during the interval 0:180?

Subject: Flow problem

From: Paul Hanson

Date: 28 Sep, 2010 19:30:21

Message: 2 of 5

> how can I make it show the amount of v in the tank at each minute t during the interval 0:180?
How's this...
-----------
interval=[0:1:180];
vo=0; %could be any starting value
v1=zeros(1,length(interval));
for i=1:length(interval)
    v1(i)=vo+interval(i)*(10-0.1*vo);
end
plot(vo,v1)
---------
probably not very efficient for calculations, but it's quick enough. :-)

Subject: Flow problem

From: TideMan

Date: 28 Sep, 2010 22:13:04

Message: 3 of 5

On Sep 29, 8:04 am, "Brittani " <ikimats...@aol.com> wrote:
> I am trying to figure out how to plot the equation:
>
> dv = dt(10-0.1v)
>
> where v(0) is 200
> and the time is from 0:180
>
> solving the equation, I get:
>
> v(1) - v(0) = dt ( 10 - 0.1 * v(0) )
>
> therefore,
>
> v(1) = v(0) + dt ( 10 - 0.1 * V(0) )
>
> how can I make it show the amount of v in the tank at each minute t during the interval 0:180?

I assume dv and dt are increments in v and t?
If so, how do you get:
v(1) = v(0) + dt ( 10 - 0.1 * V(0) )

I get:
v(1)=v(0) - 10*exp((-t(1)-t(0))/10)

Subject: Flow problem

From: Roger Stafford

Date: 28 Sep, 2010 22:13:05

Message: 4 of 5

"Brittani " <ikimatsu02@aol.com> wrote in message <i7te7j$5q1$1@fred.mathworks.com>...
> I am trying to figure out how to plot the equation:
>
> dv = dt(10-0.1v)
>
> where v(0) is 200
> and the time is from 0:180
>
> solving the equation, I get:
>
> v(1) - v(0) = dt ( 10 - 0.1 * v(0) )
>
> therefore,
>
> v(1) = v(0) + dt ( 10 - 0.1 * V(0) )
>
> how can I make it show the amount of v in the tank at each minute t during the interval 0:180?
- - - - - - - - - -
  Instead of using discrete time intervals you can consider your equation as one in the infinitesimal, that is a differential equation.

 dv/dt = 10-.1*v

This is readily solved to be:

 v = 100-(100-v(0))*exp(-.1*t) = 100*(1+exp(-.1*t))

  Therefore, you can compute

 t = 0:180;
 v = 100*(1+exp(-.1*t));
 plot(t,v)

  Note: You will find that v drops down to essentially 100 very early in this period of time. (I have assumed that the time units for dt in your original equation are also measured in minutes.)

Roger Stafford

Subject: Flow problem

From: Paul Hanson

Date: 19 Nov, 2010 19:30:22

Message: 5 of 5

---
DUDE, I am so kicking myself for not taking this to the next level. KUDOS.
Paul
---
> Instead of using discrete time intervals you can consider your equation as one in the infinitesimal, that is a differential equation.
>
> dv/dt = 10-.1*v
>
> This is readily solved to be:
>
> v = 100-(100-v(0))*exp(-.1*t) = 100*(1+exp(-.1*t))
>
> Therefore, you can compute
>
> t = 0:180;
> v = 100*(1+exp(-.1*t));
> plot(t,v)
>
> Note: You will find that v drops down to essentially 100 very early in this period of time. (I have assumed that the time units for dt in your original equation are also measured in minutes.)
>
> Roger Stafford

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us