MATLAB Answers

how to change value in element

조회 수: 5(최근 30일)
vaya putra
vaya putra 2021년 9월 26일 7:23
답변: Image Analyst 2021년 9월 26일 14:44
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
KSSV 2021년 9월 26일 7:25
You have functions to smooth the about smooth.

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV 2021년 9월 26일 7:26
편집: KSSV 2021년 9월 26일 7:27
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 ;
You can also do the same without loop.
i = 4901 : 4949 ;
p(i) = (p(i)+p(i+1))/2 ;

추가 답변(1개)

Image Analyst
Image Analyst 2021년 9월 26일 14:44
You can use movmean(), smooth(), or conv().




Community Treasure Hunt

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

Start Hunting!

Translated by