1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Open Loop Transfer Function from Differential Equations

  1. Jan 10, 2014 #1
    1. The problem statement, all variables and given/known data

    Generate an open loop u(t) and simulate. Plot x(t) and y(t)

    [itex]\dot{x}[/itex] = Vcos(θ)
    [itex]\dot{y}[/itex] = Vsin(θ)
    [itex]\dot{θ}[/itex] = u

    I am given initial values. All are 0 except for [itex]\dot{x}[/itex](0) = V.

    2. Relevant equations

    Laplace Transform Tables

    3. The attempt at a solution

    I think I know how to find the transfer functions [itex]\frac{X}{U}[/itex] and [itex]\frac{Y}{U}[/itex], which is what I'm assuming the problem statement is asking for. I first found [itex]\frac{θ}{U}[/itex] which is equal to [itex]\frac{1}{s}[/itex]. I am now trying to find the transfer functions [itex]\frac{X}{θ}[/itex] and [itex]\frac{Y}{θ}[/itex] so that I can multiply it by the transfer function θ/U. My problem is finding the Laplace transform of the given [itex]\dot{x}[/itex] and [itex]\dot{y}[/itex] equations. I know that the Laplace transform of cos(at) and sin(bt) are s/(s^2 + a^2) and b/(s^2 + b^2) respectively, however I am not sure of these transforms when the input is inside of the cosine and sine functions. My original thinking was the transfer functions X/θ and Y/θ would simply be given as V*s/(s^2 + 1) and V/(s^2+1) respectively but because the cosine and sine arguments aren't simply at and bt I am being thrown off.

    I am trying to find the Laplace transforms of [itex]\dot{x}[/itex] = Vcos(θ) and [itex]\dot{y}[/itex] = Vsin(θ) when [itex]\dot{θ}[/itex] = u ([itex]\frac{θ}{U}[/itex] = [itex]\frac{1}{s}[/itex])
  2. jcsd
  3. Jan 10, 2014 #2

    rude man

    User Avatar
    Homework Helper
    Gold Member

    Are you sure you're supposed to find closed-form transfer functions?

    As I interpret the problem, they want you to generate an arbitrary u(t), then run a software simulation to get x(t) and y(t).
  4. Jan 10, 2014 #3
    Thank you for the reply.

    I'm actually not sure I'm supposed to find the closed-form transfer functions. The problem statement is kind of vague.

    I am unclear as to how I would simulate this. Or what I am even simulating.

    Just thinking about that off the top of my head, I would make a time vector and a vector for theta, which would range from 0 to pi/4 as by inspection that is the highest angle the car takes when switching lanes. Then I could produce plots of x_dot(t) vs t and y_dot(t) vs t and integrate. Is this what you had in mind?
  5. Jan 10, 2014 #4

    rude man

    User Avatar
    Homework Helper
    Gold Member

    Car? Switching lanes?
    Maybe you should state the entire problem verbatim.

    You can use simulation software like Simulink. You can also use Excel.
    With excel, put time in column A, u(t) in B (you make this whatever you want), theta in column C = integrated u(t), then sin theta and cos theta in D and E, then x-dot and y-dot in F and G, then x and y in H and I.
  6. Jan 11, 2014 #5
    I didn't state the entire problem because there really isn't much to it. I thought I had a better grasp on it than I apparently do. Here is the entire problem, including the picture used to describe the motion of the car as it switches lanes.

    I am still unsure of how I would simulate this. I ran a little program in MATLAB using a time vector with the given times, a theta vector using the driving angle of the car (by inspection), and created x_dot, y_dot, x, and y vectors.

    (I set V = 1)
    x_dot = cos(theta);
    y_dot = sin(theta);
    x = sin(theta);
    y = -cos(theta)

    Plotting these vectors versus time, though, doesn't make too much sense as y is always negative and the x plot doesn't really describe motion in the x direction at all.

    Thank you for your help.

    Attached Files:

    • HW1.pdf
      File size:
      43.5 KB
  7. Jan 11, 2014 #6
    One problem I recognize that I did is integrate x_dot and y_dot incorrectly. x_dot and y_dot are dx/dt and dy/dt respectively, therefore when I integrate I am integrating the left with respect to x (or y) and the right side with respect to t. However, I believe theta is also a function of time so I am not sure how to handle that.
  8. Jan 11, 2014 #7
    My new train of thought is this...

    d(theta)/dt = u -----> d(theta) = u*dt -----> theta = u*t
    dx/dt = Vcos(theta) -----> dx = Vcos(theta)*dt -----> dx = Vcos(u*t)*dt -----> x = (V/u)*sin(u*t);
    dy/dt = Vsin(theta) -----> dy = Vsin(theta)*dt -----> dy = Vsin(u*t)*dt -----> y = (V/u) - (V/u)*cos(u*t);

    My plot for x seems to make more sense using this, as the plot shows that the car is traveling in the x direction with a large positive slope, before the slope turns negative when the velocity is split between the x and y directions at t = 7, and finally the slope increases sharply in the positive direction when the car has completed its lane switch. The y vs. t plot, however, still doesn't make much sense to me as it seems to be a copy of the x vs t plot.
    Last edited: Jan 11, 2014
  9. Jan 11, 2014 #8

    rude man

    User Avatar
    Homework Helper
    Gold Member

    theta = ∫u(t)dt but = u*t only if u is not a function of time. But it obviously is. θ starts at 0, goes to some max value, then (apparently) symmetrically returns to zero. So u cannot be a constant since u = dθ/dt.

    x is in the direction of travel along the road, and y points "up" on the page. Then θ has to be some function of time such that θ(0) = θ(14) = 0 and θ(7) = maximum. It's up to you to define this function. It will define the shape of the "S" curve as the car shifts lanes.

    One possibility is θ(t) = θ0sin(πt/14), 0 < t < 14. θ0 would be the max value of θ.

    Now you can compute x'(t) and y'(t), then x(t) and y(t) by integration.
    You can also compute u(t) by integration but I don't see why you need to unless θ(t) has to be defined in terms of its time derivative u(t) rather than by itself as I did above.
    Last edited: Jan 11, 2014
  10. Jan 12, 2014 #9
    Okay this all makes perfect sense.

    I now have clear plots of x_dot vs. t and y_dot vs. t that describe the x and y direction velocities. My problem is now calculating the integrals of these functions.

    Integrating [itex]\dot{x}[/itex] = Vcos(θ0sin(πt/14)) (as well as the y_dot equation) is proving to be quite difficult. I first tried to do the integration by hand, but integration by parts and substitution don't work. I then tried to integrate using a Simulink simulation where I simply read the x_dot and y_dot arrays from the MATLAB work space and fed them into a continuous integrator (1/s), however this doesn't appear to be producing the correct plots. Do you have any method you would recommend to integrate these equations?

    Last edited: Jan 12, 2014
  11. Jan 12, 2014 #10
    I figured it out using Excel and trapezoidal areas. Thank you for your help.
  12. Jan 12, 2014 #11
    can you explain how you solved it?
  13. Jan 12, 2014 #12
    what was the function you used for u(t)? am not clear on what has to be generated...
  14. Jan 12, 2014 #13
    rude man explained it in his posts above very well in my opinion. I don't know if there is anything I can add to any of it that will add to the information.

    rude man, could you explain what the problem is looking for in Part 3?
    The problem states, "Simulate open loop control with error in x and y, x(k+1) ← f(x(k),u(k)) + εk"

    I interpret this as finding the difference between the actual position given by the picture and the simulated position given by the integration from Part 1. However, I don't have the actual position as that is what I thought we were trying to simulate in Part 1?
  15. Jan 12, 2014 #14

    rude man

    User Avatar
    Homework Helper
    Gold Member

    I'm sorry I came up with an example for θ(t) for which x' and y' are difficult to integrate. Have you tried Wolfram Alpha? You'd have to pick a value for θ0, like maybe θ0 = 30 deg = π/6.

    Don't waste time figuring out how to integrate. Either use tables, or Wolfram or similar, or find another function!

    Come up with a different θ(t) that also starts at zero at t = 0, peaks at t = 7 and gets back to zero at t = 14. How about a couple of ramps up & down:
    θ(t) = θ0(t/7), 0 < t < 7, θ(t) = θ0(14 - t)/7, 7 < t < 14?
  16. Jan 12, 2014 #15

    rude man

    User Avatar
    Homework Helper
    Gold Member

    This I have to think about myself! Will try to help later.
  17. Jan 12, 2014 #16

    rude man

    User Avatar
    Homework Helper
    Gold Member

    Second thoughts: I just remembered, you're doing a discrete-time simulation. So you will do the integration by rectangular or (better) trapezoidal integration, as you said you already did. So you don't have to try to come up with a closed-form integral. Excel can easily handle functons like sin[cos(x)] etc.
  18. Jan 12, 2014 #17
    Yes. I spent a good amount of time trying to do it on MATLAB/Simulink first, but when I tried it on Excel it was much easier to come up with the integral.
  19. Jan 12, 2014 #18
    in the second question.. from what i understood, should we change the value of u(t) after every second? right now it is a square wave for a single lane change.. if we have to keep it constant for a second, does it mean we use a periodic square wave?? i hope u can understand what i mean...
  20. Jan 13, 2014 #19

    rude man

    User Avatar
    Homework Helper
    Gold Member

    A square wave for u(t) would be good:
    u(t) = k, 0 < t < 7
    u(t) = -k, 7 < t < 14.

    This in fact would give you the ramp-up/ramp-down for theta I suggested in post 16.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted

Similar Discussions: Open Loop Transfer Function from Differential Equations