My Math Forum  

Go Back   My Math Forum > College Math Forum > Differential Equations

Differential Equations Ordinary and Partial Differential Equations Math Forum


Reply
 
LinkBack Thread Tools Display Modes
August 6th, 2008, 07:15 AM   #1
Newbie
 
Joined: Aug 2008

Posts: 3
Thanks: 0

Differential equation and comp simulation

Hello guys

So I have a process model where I regulate the temperature on the surface of a light bulb. I logged a response curve from this model, and made a first order plus dead time(FOPDT) model from the response data that fits pretty well with the real thing. The problem is that the first order plus dead time model is a differential equation, and I really want to simulate the process on my computer. How do I go about doing that?

Here's a pic from my log with the process response and the mathematical model:


Thanks in advance, and I really hope at least one of you understand what I'm asking for
TommyTH is offline  
 
August 6th, 2008, 08:10 AM   #2
Member
 
Joined: Jul 2008
From: Minnesota, USA

Posts: 52
Thanks: 0

Re: Differential equation and comp simulation

So, you just want a numerical approximation, right? I would just step the independent variable forward by some small increment, maybe .001 or .0001 s, and see what that got me. Do you know any programming language that could do this reasonably fast? Python, C/C++, Java? (Python being the slowest, I think)
NClement is offline  
August 6th, 2008, 08:57 AM   #3
Newbie
 
Joined: Aug 2008

Posts: 3
Thanks: 0

Re: Differential equation and comp simulation

Quote:
Originally Posted by NClement
So, you just want a numerical approximation, right? I would just step the independent variable forward by some small increment, maybe .001 or .0001 s, and see what that got me. Do you know any programming language that could do this reasonably fast? Python, C/C++, Java? (Python being the slowest, I think)
I was thinking about using my computer to simulate the behavior of the process in continuous time, if that makes any sense . The graph in my previous post shows how the temperature on the surface of the light bulb increased when I turned it on, the red line shows how the mathematical model predicted the process response. I've made a differential equation that describes the process, but I don't know how to use it in simulation.

I know Delphi pretty well, but I'm learning C++.
TommyTH is offline  
August 6th, 2008, 11:26 AM   #4
Global Moderator
 
CRGreathouse's Avatar
 
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 938

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Re: Differential equation and comp simulation

Quote:
Originally Posted by TommyTH
I've made a differential equation that describes the process, but I don't know how to use it in simulation.
NClement just told you: make small steps with the differential equation. Say you have f(1) = a and f(1.001) = b. Then f'(1.001) is about (b - a) / (1.001 - 1), so you can use f(1.001) and your approximate f'(1.001) to calculate f(1.002).

For smooth functions, taking steps like 0.001 should be fine for most purposes. If your function was more jagged I might have suggested a smaller interval -- though you could decrease it if you like.
CRGreathouse is offline  
August 6th, 2008, 12:13 PM   #5
Member
 
Joined: Jul 2008
From: Minnesota, USA

Posts: 52
Thanks: 0

Re: Differential equation and comp simulation

Quote:
Originally Posted by TommyTH
I was thinking about using my computer to simulate the behavior of the process in continuous time, if that makes any sense .
I think what you are probably looking for is called an analytic solution. Though we would all like to always have an analytic solution, sometimes we have to settle for a less satisfying numerical solution. This is accurate enough in most cases and just plain more practical. As CRGreathouse said though, your function could conceivably be somewhat sensitive to very small errors. Generally in the context of D.E.'s, you would talk about sinks and sources. If you can't decide whether your function is "stable", you can post it here and we can probably help you out.

-Nathan
NClement is offline  
August 6th, 2008, 02:31 PM   #6
Newbie
 
Joined: Aug 2008

Posts: 3
Thanks: 0

Re: Differential equation and comp simulation

Okay, thank you guys for your helpful replies!

I'll start programming soon after reading up on numerical and analytic solutions. Again, thank you, I've been looking for a good answer to this for a long time, now I think I'm finally moving forward with this project again
TommyTH is offline  
August 6th, 2008, 06:29 PM   #7
Global Moderator
 
CRGreathouse's Avatar
 
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 938

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Re: Differential equation and comp simulation

Quote:
Originally Posted by NClement
I think what you are probably looking for is called an analytic solution. Though we would all like to always have an analytic solution, sometimes we have to settle for a less satisfying numerical solution. This is accurate enough in most cases and just plain more practical.
It's easier to accept numerical solutions once you realize that even closed form solutions have to be calculated numerically, and are subject to the same kinds of accuracy and rounding errors.

Quote:
Originally Posted by NClement
As CRGreathouse said though, your function could conceivably be somewhat sensitive to very small errors. Generally in the context of D.E.'s, you would talk about sinks and sources. If you can't decide whether your function is "stable", you can post it here and we can probably help you out.
I used a highly complex technique to determine if the function was smooth enough for numerical methods: I looked at the pretty picture of the function above and eyeballed it as 'looks basically smooth to me'. This skill was taught to me by an ancient master of the technique and required years of preparation: meditation, punching through wooden boards, carrying water up three hundred stairs, and finally culminated with a fight to the death with the other student who wished to learn the technique.
CRGreathouse is offline  
August 7th, 2008, 12:33 AM   #8
Member
 
Joined: Jul 2008
From: Minnesota, USA

Posts: 52
Thanks: 0

Re: Differential equation and comp simulation

Quote:
Originally Posted by CRGreathouse
This skill was taught to me by an ancient master of the technique and required years of preparation: meditation, punching through wooden boards, carrying water up three hundred stairs, and finally culminated with a fight to the death with the other student who wished to learn the technique.


Dangit, I knew I was missing something!
NClement is offline  
Reply

  My Math Forum > College Math Forum > Differential Equations

Tags
comp, differential, equation, simulation



Search tags for this page
Click on a term to search for related topics.
Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
48th Annual Olympiad High School Prize Comp. wuzhe New Users 3 November 2nd, 2011 12:04 PM
Registrations now OPEN: 5th International Mental Maths Comp. pgato Academic Guidance 0 October 3rd, 2010 10:44 AM
Simulation in Queuing Models: Using Simulation at Beit-eba c aminay Math Books 0 December 12th, 2009 05:21 AM
Math simulation Alexkungfu Algebra 0 May 22nd, 2008 09:27 PM
To all the people who are interested in comp sci, READ THIS johnny New Users 2 March 29th, 2008 04:29 PM





Copyright © 2019 My Math Forum. All rights reserved.