function [wf,P]=prop_fuel_flow(flight_condition,h,V,P,wf_to_matrix,wf_c_matrix,wf_cr_matrix_A,...
   wf_cr_matrix_B,wf_cr_matrix_C,wf_cr_matrix_D,h_to_matrix,h_c_matrix,h_cr_matrix,...
   v_to_matrix,v_c_matrix,v_cr_matrix,P_to_in,P_c_in,P_cr_in_A,P_cr_in_B,P_cr_in_C,P_cr_in_D)

if flight_condition == 1
   % Takeoff Condition
	wf = INTERP2(h_to_matrix,v_to_matrix,wf_to_matrix,h,V);
   P = INTERP2(h_to_matrix,v_to_matrix,P_to_in,h,V);
   
elseif flight_condition == 2
	% Max Climb / Normal Cruise Rating
	wf = INTERP2(h_c_matrix,v_c_matrix,wf_c_matrix,h,V);
	P = INTERP2(h_c_matrix,v_c_matrix,P_c_in,h,V);
   
else
	% Cruise Condition
	p_poly=[INTERP2(h_cr_matrix,v_cr_matrix,P_cr_in_A,h,V), ...
   	INTERP2(h_cr_matrix,v_cr_matrix,P_cr_in_B,h,V), ...
   	INTERP2(h_cr_matrix,v_cr_matrix,P_cr_in_C,h,V), ...
   	INTERP2(h_cr_matrix,v_cr_matrix,P_cr_in_D,h,V)];
	wf_poly=[INTERP2(h_cr_matrix,v_cr_matrix,wf_cr_matrix_A,h,V),...
   	INTERP2(h_cr_matrix,v_cr_matrix,wf_cr_matrix_B,h,V),...
   	INTERP2(h_cr_matrix,v_cr_matrix,wf_cr_matrix_C,h,V),...
   	INTERP2(h_cr_matrix,v_cr_matrix,wf_cr_matrix_D,h,V)];
	cruise_polyfit=polyfit(p_poly, wf_poly,3);
   wf = polyval(cruise_polyfit,P);
end	% if statement
