Numerical Inputs to Solve and Using the Output value

7 views (last 30 days)
Hi,
I have a question about how to use solve. I want to solve an equation for 1 variable, where the other variables in the equation have been calculated as variables earlier in the function. I then want to use the solved for value as a number in later calculations. I seem to be going about this all wrong. Some help with how I could do this and what my errors are would be great.
function [ dVTot dVInit dVinf FinTOrbfbRa ] = vinfleverage(K,L,M,Dir,ParkR,PInitTran,fbRad)
%{
Input Assumptions:
K: Number of Earth Orbit revolutions
L:Number of spacecraft revolutions
M:Orbit of dV manuever
Dir: Pre or Post periapsis intercept
ParkR: Parking Orbit radius
PInitTran: Initial transfer orbit period
fbRad: Fly by radius
Outputs:
dVTot: Total dV for the entire manuever
dVInit: dV to leave inital parking orbit
dVinf: Vinf leveraging manuever delta V in deep space
FinTOrbfbRa: Final post-fly by apoapsis radius
%}
%Constants
Re = 149600000; %Earth orbit radius
MewS = 132700000000; %Standard gravitational parameter of the sun
MewE = 398600; %Standard gravitational parameter of the earth
Ve = sqrt(MewS/Re); %Velocity of the earth
%Velocity in the parking orbit
Vpark = sqrt(MewE/ParkR);
%Total inital velocity prior to burn
Vinit = Ve + Vpark;
%For the initial orbit, Rp = Re, find the initial apoapsis (and final?)
Ra_init = ( (((PInitTran/pi)^2)*2*MewS)^(1/3) )-Re;
%Use the initial apoapsis to solve for the initial transfer velocty
syms Vtran;
Vt = solve(Ra_init == (Re^2*Vtran^2)/(2*MewS-Re*Vtran), Vtran);

Answers (1)

Kevin Holst
Kevin Holst on 16 Mar 2012
The problem may be that you're expecting a single value, but solve will return 2 values because it's actually quadratic.
What is the error message that you're getting? I'm not sure I have enough information here.

Categories

Find more on Satellite and Orbital Mechanics in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by