Trinity-SpaceData / conjunction /nasa_cara /DistributedMatlab /EventRate /src /ConjDist /interp_LogPrem.m
Download conjunction/nasa_cara/DistributedMatlab/EventRate/src/ConjDist/interp_LogPrem.m from STAR-future/Trinity-SpaceData: direct link, hf CLI and curl.
- Browser
- Download file 2.78 kB
-
https://huggingface.co/datasets/STAR-future/Trinity-SpaceData/resolve/main/conjunction/nasa_cara/DistributedMatlab/EventRate/src/ConjDist/interp_LogPrem.m
- Command line
-
hf download hf://datasets/STAR-future/Trinity-SpaceData/conjunction/nasa_cara/DistributedMatlab/EventRate/src/ConjDist/interp_LogPrem.m
-
curl -L -o interp_LogPrem.m https://huggingface.co/datasets/STAR-future/Trinity-SpaceData/resolve/main/conjunction/nasa_cara/DistributedMatlab/EventRate/src/ConjDist/interp_LogPrem.m
2.78 kB
| function LogPremint = interp_LogPrem(LogPcum,LogPrem,LogPcumgoal) | |
| % interp_LogPrem - Interpolate LogPrem values | |
| % | |
| % Syntax: LogPremint = interp_LogPrem(LogPcum,LogPrem,LogPcumgoal) | |
| % | |
| % ========================================================================= | |
| % | |
| % Copyright (c) 2025 United States Government as represented by the | |
| % Administrator of the National Aeronautics and Space Administration. | |
| % All Rights Reserved. | |
| % | |
| % ========================================================================= | |
| % | |
| % Description: Interpolate LogPrem values. Returns a Prem value | |
| % corresponding to the desired Pcum through linear | |
| % interpolation of Prem and corresponding Pcum values | |
| % | |
| % ========================================================================= | |
| % | |
| % Input: | |
| % | |
| % LogPcum - Log of Pcum values [1xN] | |
| % | |
| % LogPrem - Log of Prem values corresponding to LogPcum values [1xN] | |
| % | |
| % LogPcumgoal - Desired LogPcum value for which to interpolate a | |
| % corresponding LogPrem | |
| % ========================================================================= | |
| % | |
| % Output: | |
| % | |
| % LogPremint - Interpolated Prem value corresponding to LogPcumgoal | |
| % | |
| % ========================================================================= | |
| % | |
| % Dependencies: | |
| % | |
| % None | |
| % | |
| % ========================================================================= | |
| % | |
| % Subfunctions: | |
| % | |
| % None | |
| % | |
| % ========================================================================= | |
| % | |
| % Initial version: Apr 2022; Latest update: Apr 2022 | |
| % | |
| % ----------------- BEGIN CODE ----------------- | |
| if LogPcum(1) > LogPcumgoal | |
| LogPremint = LogPrem(1); | |
| elseif LogPcum(end) < LogPcumgoal | |
| LogPremint = min(LogPcumgoal,LogPrem(end)); | |
| else | |
| n1 = max(find((LogPcum <= LogPcumgoal))); | |
| n2 = n1+1; | |
| LogPremint = interp1(LogPcum(n1:n2),LogPrem(n1:n2), ... | |
| LogPcumgoal,'linear','extrap'); | |
| LogPremint = min(LogPcumgoal,LogPremint); | |
| end | |
| return; | |
| end | |
| % ----------------- END OF CODE ------------------ | |
| % | |
| % Please record any changes to the software in the change history | |
| % shown below: | |
| % | |
| % ----------------- CHANGE HISTORY ------------------ | |
| % Developer | Date | Description | |
| % --------------------------------------------------- | |
| % D. Hall | 2022-Apr-11 | Initial version. | |
| % ========================================================================= | |
| % | |
| % Copyright (c) 2025 United States Government as represented by the | |
| % Administrator of the National Aeronautics and Space Administration. | |
| % All Rights Reserved. | |
| % | |
| % ========================================================================= |