Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

A little MATLAB help

  1. Dec 6, 2007 #1
    Hi everyone,

    Its been an incredibly long time since I've had to solve a differential equation in MATLAB, and I was wondering if someone could point me in the right direction. I have the following equation:

    m*(dV/dt) = F_rho - F_mu + F_g

    the F_rho term includes just constants that I know
    the F_mu term depends on V
    the F_g term includes constants that I know

    I'm pretty clueless as to how to set this up and get started on this, maybe once I get the ball rolling it'll come back to me. :) Any help you could provide is appreciated. Thanks!
     
  2. jcsd
  3. Dec 6, 2007 #2

    CompuChip

    User Avatar
    Science Advisor
    Homework Helper

    I wouldn't know how to do it in MATLAB, but in Mathematica it would be fairly simple: just plug in the formula and apply DSolve. It will even solve it symbolically (i.e. you don't have to put in the values for the constants --- I don't know if MATLAB does this too).

    Do you know the actual formulas for the different forces, or do you just know that [itex]F_\mu[/itex] is some function of V and the other two are some constant?
     
  4. Dec 6, 2007 #3
    Thanks for the reply,

    I have the actual equations for those forces, I just didn't write them out before to save some time. :)

    F_rho = 2*pi*r*rho*(cos(theta1)-cos(theta2))

    F_mu = 8*pi*mu*l*V + 8*pi*mu_g*(L-l)*V

    F_g = pi*sigma*r^2*l*g*sin(phi)

    I apologize for the horrible formatting, I'd retype it if I knew the latex syntax.

    But yes, basically I know everything in F_rho, I know everything but V in F_mu, and I know everything in F_g.
     
  5. Dec 6, 2007 #4

    CompuChip

    User Avatar
    Science Advisor
    Homework Helper

    No problem, I'm used to something :)
    I'm afraid I still can't help you with solving this in MATLAB, though this equation is sufficiently simple that it can be solved by hand. I'll assume now that you have had some basic differential equations, if not, skip the next part.

    We can write it as
    [tex]V'(t) = C + \mu V(t)[/tex]
    where C is the sum of F_rho and F_g and mu is the thing in front of the V (something like 8 pi (mu l + mu_g (L - l))).
    There is a linear dependence (V'(t) ~ V(t)) so you could try V(t) = exp(alpha t) and then see what alpha would have to be, to solve the homogeneous equation m V'(t) = mu V(t).
    For the particular solution, m V'(t) = C + mu V(t), you could try a constant, because then the left hand side is zero and you immediately get V_part = - C / mu.
    The general solution is the sum of the particular part and the solution to the homogeneous equation, so it will be something like -C/mu + exp(alpha t).

    ====

    In Mathematica, you could solve it by something like
    DSolve[m V'[t] == F\[Rho] + Fg + \[Mu] V[t], V[t], t]

    And again, I'm not sure if MATLAB, will be able to solve it symbolically (non-numerically).

    Whichever method you choose, this is a very basic differential equation and you will probably want to learn how to solve it by hand anyway.

    Hope that helps you a bit, though it doesn't really answer your original question (I don't know how tightly bound you are to MATLAB)
     
  6. Dec 7, 2007 #5
    Thank you for the explanation, CompuChip. Unfortunately, I am pretty tied to MATLAB, as I don't have access to a program like Mathematica, although I will try to get access to it. I'm glad to find out that this is a relatively simple one that should be able to be solved without much difficulty.

    In the end, what I'd like to have happen is for me to be able to change some of the variables a bit, and see how V is affected. Eventually I'll make some of those variables time dependent and see how that affects V as well.

    Thanks!
     
  7. Dec 15, 2007 #6

    mda

    User Avatar

    type 'help ode45' to get started

    As it says, basically you set up a function that calculates dV/dt from V and t and go from there. Later you can set numerical options using 'odeset' if you need to.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: A little MATLAB help
  1. MATLAB help (Replies: 9)

  2. MATLAB help (Replies: 2)

  3. MATLAB help (Replies: 0)

  4. MATLAB help (Replies: 7)

  5. Matlab help (Replies: 6)

Loading...