![]() |
|
|
#1 | ||
|
College Benchwarmer
Join Date: Oct 2000
Location: calgary, AB
|
Who's good with math and vba?
Apparently I'm not anymore.
I've got a series of equations that I'm trying to evaluate at work using vba and it's just not working out for me. Most of the evaluation I can get to work out, it's just the velocity term that is really getting away from me. The velocity (dv/dt) term is shown below: ![]() The biggest contributions to the velocity term is the Av term and the Can term. K is a function of dv/dt where K = Ko*sin(theta) and is shown below. ![]() and x can be found through dx/dt = v I am evaluating the velocity term using a 4th order runge-kutta function with a step of 0.01 as v = f(t,v). There is a term to check the growth of the error which I am evaluating using Simpson's 1/3 rule, which is shown below: ![]() I have 1 series of data so I've been able to check my Can and Caer terms and they are giving the right numbers. The velocity I obtain from the dv/dt is much larger than it should be. The velocity I obtain from the check of the velocity is slightly higher than it should be. I've also included my code. I'm not really sure if I'm doing the RK method right as I've never evaluated an equation with the d/dt terms on the RHS before and am unsure how to approach them. I'm sorry if this message is a big jumbled, let me know if there's anything you need to clarify it. I'm getting pretty frustrated as I been working on this off and on for a few days now and am really not sure what I'm doing, let alone what I am doing wrong. Thanks for any help you can provide! Code:
Last edited by nilodor : 09-04-2012 at 12:31 PM. |
||
|
|
|
|
|
#2 |
|
Pro Starter
Join Date: Oct 2000
Location: Cary, NC
|
__________________
-- Greg -- Author of various FOF utilities |
|
|
|
|
|
#3 |
|
College Benchwarmer
Join Date: Oct 2000
Location: calgary, AB
|
Well maybe you don't need to be good at vba. I think I'm just really screwing up the runge kutta integration for the velocity term. Basically I'm taking v and replacing it with (vi + kh) where vi is the velocity from the previous time step, and kh is the runge kutta k times the step size and coefficient term. Then for time, t is replaced by t+h where h is the coefficient of the time step. I'm really not sure what to do with the dCan/dt or dhv/dt terms and I'm not entirely sure why the other estimation of velocity using simpsons rule is out as well, or why I can't just use that term instead (well if it was giving me the right answer). |
|
|
|
|
|
#4 |
|
College Benchwarmer
Join Date: Oct 2000
Location: calgary, AB
|
Never mind, apparently I can't take derivatives any more either! I was screwing up the dhv and dCan terms.
Math is a cruel mistress when you forget the rules. |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|