# Why does the correctairspeed function use a different formula than the formula given in the documentation?

1 view (last 30 days)
Sam on 8 Mar 2020
Edited: Sam on 8 Mar 2020
Hi,
I'm using the MATLAB aerospace toolbox, amongst others to calculate the calibrated airspeed from the true airspeed. For this, I use the MATLAB function correctairspeed. In the documentation, it says to input an (array of) airspeed(s), speed(s) of sound, and static pressure(s) as the first three arguments. These are not necessarily mean sea-level (MSL) values. Then, looking at the Calibrated Airspeed implementation/formula on this page, I see a different implementation of the Calibrated Airspeed. Here, the MSL air density and pressure are used.
The discrepancy between the two is confirmed when comparing the two methods (1. using the formula, 2. using the correctairspeed function). Note that the equality check in the code below is only illustrative: I did actually check the numbers and they're quite off.
V = 100;
[T0, a0, p0, rho0] = atmosisa(0);
[T, a, p, rho] = atmosisa(1000);
% This gives the correct value of the CAS at an altitude of 1000 meter
CASfunction = correctairspeed(V, a, p, 'TAS', 'CAS', 'Equation');
% This doesn't
CASformula = sqrt((2 * 1.4 * p0)/((1.4-1) * rho0) * ((1/2 * rho0 * V ^2 / p0 + 1) ^((1.4 - 1)/1.4) - 1));
% Meaning that the two outcomes aren't equal.
CASfunction == CASformula
ans =
logical
0
% Changing p0 to p at 1000 m doesn't help
CASformula = sqrt((2 * 1.4 * p)/((1.4-1) * rho0) * ((1/2 * rho0 * V ^2 / p + 1) ^((1.4 - 1)/1.4) - 1));
CASfunction == CASformula
ans =
logical
0
% And changing rho0 to rho at 1000 m doesn't either
CASformula = sqrt((2 * 1.4 * p0)/((1.4-1) * rho) * ((1/2 * rho * V ^2 / p0 + 1) ^((1.4 - 1)/1.4) - 1));
CASfunction == CASformula
ans =
logical
0
Even when trying changing each of the p0 and rho0 to non-MSL values p and rho, individually, I don't get the right values.
I would like to have the anlayitcal formula underlying correctairspeed because I want to determine the formula for the time derivative of the CAS. Now my question is, whether the analytical formula that is actually used for the calibrated airspeed in the correctairspeed is documented somewhere. I only need the formula for subsonic velocities.
##### 2 CommentsShowHide 1 older comment
Sam on 8 Mar 2020
Ah, yes that might've been unclear from my example. I did look at the numbers, but I thought the above example would illustrate it more clearly. The values differ about 5% in the above example. However, this difference increases more and more with increasing altitude. At an altitude of 10,000 m, say, the difference is more than 40%. I can see how this happens, because the formula - as opposed to the correctairspeed function - doesn't include any altitude effects; only MSL values are used. Therefore, the effects of decreasing air density and pressure with altitude aren't "seen" in the calculation of the CAS. However, reading the docs, it seems to be pointed out very explicitly that MSL values should be used.

R2019b

### Community Treasure Hunt

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

Start Hunting!