Keep getting error about invalid parameter name.
Afficher commentaires plus anciens
I'm attempting to create a table in Matlab that shows temperature, pressure and air density changes over altitute. Got stuck on the table side of things.
clear; clc;
i_a = input ('Enter Initial Altitude: ');
e_a = input ('Enter End Altitude: ');
i = input ('Enter Increment: ');
o_t = input ('Enter Offset Temperature: ');
while i_a > 33000 || e_a > 33000
fprintf('You have left the Troposphere. Please input values smaller than or equal to 33,000 ft. \n');
i_a = input ('Enter Initial Altitude: ');
e_a = input ('Enter End Altitude: ');
i = input ('Enter Increment: ');
o_t = input ('Enter Offset Temperature: ');
end
while i_a < 0 || e_a < 0
fprintf('You have gone under sea level. Are you Dutch? Please input values bigger than or equal to 0 ft. \n');
i_a = input ('Enter Initial Altitude: ');
e_a = input ('Enter End Altitude: ');
i = input ('Enter Increment: ');
o_t = input ('Enter Offset Temperature: ');
end
a = [];
a_t = [];
p = [];
d = [];
c_a = i_a;
while c_a <= e_a
a = [a; c_a];
c_a = c_a + i;
m_a = a * 0.3048;
a_t = 288.15 + o_t - 0.00649 * m_a;
p = 101325 * ((1 - 0.00649 * m_a / 288.15).^(9.806/(287.052874*0.00649)));
d = p / (287.052874 * a_t);
end
v_n = {'Altitute in ft', 'Air Temperature in Kelvin', 'Pressure in Pascal', 'Air Density in kg/m^3'};
T = table(a, a_t, p, d, 'v_n');
disp(T);
I keep getting this error but I'm not sure what I did wrong: Error using table Invalid parameter name: v_n.
It can make a table using v_n but can not fill the values on the table.
It also seems to put d as a 67x67 table while it makes all others 67x1 (edited)
Réponse acceptée
Plus de réponses (1)
Walter Roberson
le 18 Oct 2023
T = table(a, a_t, p, d, 'variablenames', v_n);
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!