-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GPOPS-II Interpolation Function Handle returned by OptimTraj #20
Comments
Excellent Question! You're totally correct - the implementation for the OptimTraj interpolation of GPOPS-II solutions is not the correct way to perform this interpolation, but it does work quite well, because of how the There would be two good ways to improve this interpolation:
Why was the code written this way? Like most short-comings in this toolbox, because I just didn't have enough time. I originally implemented the wrapper for GPOPS-II to verify that my solutions were correct. At the time, I was just using the interp() method for making nice plots. It was never worth the day or two of programming time that it would take to make the interpolation use the correct formulas. How large are the errors? Let's say that GPOPS has a single 5th-order segment. Here, I would interpolating it using six 3rd-order segments. This should be a pretty good approximation, provided that the 5th-order segment is well behaved, which it will be for the vast majority of segments. If anyone has time to work out the specific math, let me know! This would be a great numerical methods extra credit problem. |
May i ask a question that how to get pneumatic parameter using interpolation? I have alredy got the oringinal data ponits of pneumatic parameter but i want to get the pneumatic parameter with specific Mach number and Angle of attack...thankyou |
I'm going to need a bit more context to answer your question... but here is
a guess:
1) Pneumatic parameter is known ahead of time, and is stored as tabulated
data as a function of mach number and angle of attack. In this case you
will need to generate an interpolation function. I suggest that you use
bi-cubic interpolation, which matlab has built-in tools for. Linear
interpolation is easier, but has a non-smooth gradient which can mess up
the optimization.
2) Pneumatic parameter is one of your states (or controls) in the
optimization problem. In this case, you can interpolate it using the
function handle (or PP-form struct) returned by OptimTraj for any method.
…On Tue, Apr 30, 2019 at 12:45 AM areusiriuses ***@***.***> wrote:
May i ask a question that how to get pneumatic parameter using
interpolation? I have alredy got the oringinal data ponits of pneumatic
parameter but i want to get the pneumatic parameter with specific Mach
number and Angle of attack...thankyou
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#20 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB6CWOIUJE5S4MCRKYGZONDPS7FGPANCNFSM4CPEWK5A>
.
|
THANK YOU~I have solved this problem |
In gpopsWrapper.m, OptimTraj provides an interpolation function handle for the GPOPS-II solution using pchip, as per the code below. Is pchip the most accurate way to interpolate the GPOPS-II solution?
soln.interp.state = @(t)( interp1(tSoln',xSoln',t','pchip',nan)' );
soln.interp.control = @(t)( interp1(tSoln',uSoln',t','pchip',nan)' );
The formula for the GPOPS-II state is given in equation (25) of the GPOPS-II paper:
Patterson, Michael A., and Anil V. Rao. "GPOPS-II: A MATLAB software for solving multiple-phase optimal control problems using hp-adaptive Gaussian quadrature collocation methods and sparse nonlinear programming." ACM Transactions on Mathematical Software (TOMS) 41.1 (2014): 1.
http://dl.acm.org/citation.cfm?id=2558904
The text was updated successfully, but these errors were encountered: