N
N
Natalia Filippova2018-11-11 00:42:31
MATLAB
Natalia Filippova, 2018-11-11 00:42:31

How to write the condition of the problem in MATLAB for its solution by the program?

Given the condition of the problem, which must be solved using MATLAB. The condition is as follows:
At the moment the aircraft overcomes the sound barrier, the Mach number becomes equal to one. Mach number function:
M(v,H)=sqrt(5((((1+0.2*(v/a)^2)^3.5)-1)*(1-H*b/c)^d +1)^e-1)
where
v is the aircraft flight speed;
H is the flight altitude;
coefficients:
a = 1222.5;
b = 6.875 10^-6;
c = 0.3048;
d = -5.2656;
e = 0.286.
Obtain plots of M(v) dependence for H=500; 1000; 2000; 5000; show the level M=1 corresponding to the achievement of the speed of sound.
From the condition M(v,H)=1, obtain the dependence of the speed of overcoming the sound barrier v on the height H. To do this, changing H in the range from 0 to 2.5 10^4, solve the equation M(v,H) – 1 = 0. When solving an equation, pass H to the function that describes the right side of the equation as a global data (using the global H command).
Plot the v(H) dependence for which M(v,H) = 1.
(For information: at H ≈ 0, v ≈1200 km/h; at H ≈ 2.5 * 10^4; v ≈150 km /h).
I have never worked in this program before. I tried to make something as a solution, but nothing sensible comes out. Help, please, to understand.
Here is the code:
a = 1222.5;
b = 6.875*10^(-6);
c = 0.3048;
d = -5.2656;
e = 0.286;
h = 500; 1000; 2000; 5000;
M =(sqrt(5*((((1+0.2*(v/a)^2)^3.5-1)*(1-b*h/c)^d+1)^e-1))) -one;
plot(M)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2018-11-11
@Natali166

The functions in matlab are in separate files with the extension m. The file name must match the function name.
In your case, the function receives 2 values ​​v and H as input and returns one - M.
maxa.m:

function [M] = maxa(v, H)
a = 1222.5;
b = 6.875*10^(-6);
c = 0.3048;
d = -5.2656;
e = 0.286;
M =(sqrt(5*(power(((power((1+0.2*power(v/a,2)),3.5)-1)*power(1-b*H/c, d)+1),e)-1)))-1;
end

In the Matlab console, do:
h = [500; 1000; 2000; 5000]
v = 1000
M = maxa(v, h)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question