Hi;
how to get the smoothed values of these data:
1 NaN
2 1.356390367
3 1.295994741
4 1.50041999
5 2.790612162
6 4.62246207
7 6.134079946
8 6.818989019
9 7.953940954
10 7.2993
11 10.4519388
12 12.4768
13 10.6323
14 NaN
15 11.94706861
16 6.180212227
17 7.622561145
18 6.229011638
19 4.09315833
20 2.495924367
21 2.213217555
22 2.735480781
23 2.071762287
24 1.69211523
++++
Thanks

 Respuesta aceptada

Les Beckham
Les Beckham el 25 de Oct. de 2023
Editada: Les Beckham el 25 de Oct. de 2023

0 votos

You aren't going to get very good smoothing with such a small amount of data, but here is one possibility (of many):
data = [ ...
1 NaN
2 1.356390367
3 1.295994741
4 1.50041999
5 2.790612162
6 4.62246207
7 6.134079946
8 6.818989019
9 7.953940954
10 7.2993
11 10.4519388
12 12.4768
13 10.6323
14 NaN
15 11.94706861
16 6.180212227
17 7.622561145
18 6.229011638
19 4.09315833
20 2.495924367
21 2.213217555
22 2.735480781
23 2.071762287
24 1.69211523
];
plot(data(:,1), data(:,2))
hold on
sm_data = smoothdata(data(:,2), 'sgolay'); % save the smoothed data
plot(data(:,1), sm_data)
grid on
legend('original data', 'smoothed data')

3 comentarios

ahmad Saad
ahmad Saad el 25 de Oct. de 2023
thanks for response.
how i can get the smoothed values ????
Les Beckham
Les Beckham el 25 de Oct. de 2023
You are welcome.
If you want to save the smoothed values, just assign the output of smoothdata() to a variable.
I've edited my answer to reflect this.
ahmad Saad
ahmad Saad el 25 de Oct. de 2023
Deep thanks

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Etiquetas

Preguntada:

el 25 de Oct. de 2023

Comentada:

el 25 de Oct. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by