필터 지우기
필터 지우기

Mean of samples within a for loop

조회 수: 1 (최근 30일)
Stacy
Stacy 2013년 6월 7일
Hello everyone,
How can I find mean of a chunk of samples within for loop and save it for later use?
Thanks
SK

답변 (1개)

Image Analyst
Image Analyst 2013년 6월 7일
Have you tried the built-in functions mean() and mean2()??? That's what comes to mind first. If you need further assistance, explain "chunk", and do "whos" on your array so we know what we're dealing with, give us a small example, and explain exactly what form you mean when you say "save" (e.g. a file on disk or a variable).
  댓글 수: 1
Stacy
Stacy 2013년 6월 7일
Sorry for the incomplete question. I have a filtered signal(bandpassed). that has sinusoidal for 30 sec. I tried downsample but got "Index exceeds matrix dimensions" error while windowing that 30 sec section and also lost some sample points. So what I am thinking is to analyze that 30 sec voltage signal in chunk(segments ;like 1:1000)using for loop. Inside loop, I want to find mean of that chuck, put it into vector, and do the same for other chucks and finally add them together to graph.
y4 = filter(Hd,voltage);
Fs=1612.9;
A=y4(1:Fs*30,2);
Afinal=downsample(A,Fs);
But I really think for what I am trying to do, I need for loop..
thanks

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

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by