arrange equation results from min to max to use after

t = [2993;3975.9;5063;6150;6919;8192.7;8862;10240.9;11488;12409.63;13545]
f = @(t) (2.2/9500).*((t/9500).^1.2).*exp(-((t/9500).^2.2))
g = @(t) 1-exp(-((t/9500).^2.2))
i want f(t) to be arranged from min to max to then do f(t)-g(t)
0.32398874
answers should be 0.39063829
0.31369048
0.31787694
....
...

 Respuesta aceptada

t = [2993;3975.9;5063;6150;6919;8192.7;8862;10240.9;11488;12409.63;13545]
t = 11×1
1.0e+04 * 0.2993 0.3976 0.5063 0.6150 0.6919 0.8193 0.8862 1.0241 1.1488 1.2410
f = @(t) (2.2/9500).*((t/9500).^1.2).*exp(-((t/9500).^2.2))
f = function_handle with value:
@(t)(2.2/9500).*((t/9500).^1.2).*exp(-((t/9500).^2.2))
g = @(t) 1-exp(-((t/9500).^2.2))
g = function_handle with value:
@(t)1-exp(-((t/9500).^2.2))
sort(f(t))-g(t)
ans = 11×1
-0.0757 -0.1368 -0.2215 -0.3189 -0.3921 -0.5142 -0.5760 -0.6925 -0.7810 -0.8346

5 comentarios

that's the problem the result is wrong
0.32398874
result should be like this 0.39063829
0.31369048
0.31787694
.......
....
...
Do you want to display in 8 digit format? If I am right you can do as
t = [2993;3975.9;5063;6150;6919;8192.7;8862;10240.9;11488;12409.63;13545]
t = 11×1
1.0e+04 * 0.2993 0.3976 0.5063 0.6150 0.6919 0.8193 0.8862 1.0241 1.1488 1.2410
f = @(t) (2.2/9500).*((t/9500).^1.2).*exp(-((t/9500).^2.2))
f = function_handle with value:
@(t)(2.2/9500).*((t/9500).^1.2).*exp(-((t/9500).^2.2))
g = @(t) 1-exp(-((t/9500).^2.2))
g = function_handle with value:
@(t)1-exp(-((t/9500).^2.2))
printing = @(x)fprintf('%0.8f\n', x);
printing(sort(f(t))-g(t))
-0.07572129 -0.13678446 -0.22148910 -0.31892662 -0.39209702 -0.51415077 -0.57598195 -0.69252235 -0.78096654 -0.83461035 -0.88712616
the problem is that these results are wrong
those are the correct answers
my bad i forgot that f(t) is * 10^-4 so thank you very much for helping me arranging my equation results
It's my pleassure :-)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Aerospace Blockset en Centro de ayuda y File Exchange.

Productos

Versión

R2012a

Etiquetas

Preguntada:

el 25 de Jun. de 2021

Comentada:

el 26 de Jun. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by