Info

此问题已关闭。 请重新打开它进行编辑或回答。

Output argument "variable" (and maybe others) not assigned during call to "function".

1 次查看(过去 30 天)
I'm creating a program that models the flight path of a satellite in low earth orbit, where the changing densities is necessary to compute the drag forces. My function for calculating the drag forces is as follows:
function function [ax,ay] = LEO_drag_acceleration(x,y,vx,vy,g)
C_d = 2.2; h = y; A = .3; vel = sqrt(vx.^2 + vy.^2); rho = LEO_density_range(h); ax = -((rho*C_d*A)/2)*vel*vx; ay = -g-((rho*C_d*A)/2)*vel*vy; return end
and the LEO_density_range function is as follows: function rho = LEO_density_range(h) if h < 25000 rho = 1.225; elseif h >= 25000 && h < 30000; rho = 3.899*10^-2; elseif h >= 30000 && h < 40000; rho = 1.744*10^-2; elseif h >= 40000 && h < 50000; rho = 3.972*10^-3; elseif h >= 50000 && h < 60000; rho = 1.057*10^-3; elseif h >= 60000 && h < 70000; rho = 3.206*10^-4; elseif h >= 70000 && h < 80000; rho = 8.770*10^-5; elseif h >= 80000 && h < 90000; rho = 1.905*10^-5; elseif h >= 90000 && h < 100000; rho = 3.396*10^-6; elseif h >= 100000 && h < 110000; rho = 5.297*10^-7; elseif h >= 110000 && h < 120000; rho = 9.661*10^-8; elseif h >= 120000 && h < 130000; rho = 2.438*10^-8; elseif h >= 130000 && h < 140000; rho = 8.484*10^-9; elseif h >= 140000 && h < 150000; rho = 3.845*10^-9; elseif h >= 150000 && h < 180000; rho = 2.070*10^-9; elseif h >= 180000 && h < 200000; rho = 5.465*10^-10; elseif h >= 200000 && h < 250000; rho = 2.789*10^-10; elseif h >= 250000 && h < 300000; rho = 7.248*10^-11; return end
Any ideas on how to solve this issue?

回答(0 个)

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by