Filter löschen
Filter löschen

how to change value in element

2 Ansichten (letzte 30 Tage)
vaya putra
vaya putra am 26 Sep. 2021
Beantwortet: Image Analyst am 26 Sep. 2021
I have value p consist of 10000x1 elements
to smooth my calculation i need to changes a value at p ( from 4901 to 4949) and (from 4951 to 5000)
the value should p(4951+4949)/2 and so on
if anyone could help me to solve my problem
i am really appriciate
  1 Kommentar
KSSV
KSSV am 26 Sep. 2021
You have functions to smooth the data.....read about smooth.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

KSSV
KSSV am 26 Sep. 2021
Bearbeitet: KSSV am 26 Sep. 2021
Let P be your 10000x1 array.
p0 = p ;
% To change data from 4901 to 4949
for i = 4901:4949
p(i) = (p(i)+p(i+1))/2 ;
end
You can also do the same without loop.
i = 4901 : 4949 ;
p(i) = (p(i)+p(i+1))/2 ;

Weitere Antworten (1)

Image Analyst
Image Analyst am 26 Sep. 2021
You can use movmean(), smooth(), or conv().

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by