필터 지우기
필터 지우기

i got 450082 number or data. To process the data i need to make sampling rate to separated that data in a frame. how to process that data in every frame?

조회 수: 1 (최근 30일)
  댓글 수: 2
Guillaume
Guillaume 2015년 10월 8일
The question body is just an image with no explanation.
the question title is really not clear. What exactly are you asking?
Note that
>>rem(450082, 256)
ans =
34
450082 is not a multiple of 256. Whatever your question is, you need to explain what you're planning to do with the 34 elements left over.
fooozie mtlb
fooozie mtlb 2015년 10월 8일
i got 450082 wave height data. each data have it value. to apply my formula i need to separate data into frame like 256 for each frame. that meant, frame A1 is from 1 until 256, for frame A2 from 257 until 512 and so on. my question is how can i loop data from 1 until 256 to get one value and meanwhile it will loop to another frame A2 and so on.

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

채택된 답변

Thorsten
Thorsten 2015년 10월 8일
for i = 1:256:numel(z)
zi = z(i:i+255); % get the i'th chunk of 256 values
% do some sample computations on zi
dzi = diff(zi); % difference between successive values of z
m(i)= mean(zi);
md(i) = mean(dzi); % average difference between successive values of z
end

추가 답변 (2개)

Eng. Fredius Magige
Eng. Fredius Magige 2015년 10월 8일
편집: Eng. Fredius Magige 2015년 10월 8일
Hi Your subframe, say A, are all uniformity 256 for n=1:450082/256 process whatever your requirement in each subframe as calling function: for nn=n:nnn end end
  댓글 수: 1
fooozie mtlb
fooozie mtlb 2015년 10월 8일
편집: fooozie mtlb 2015년 10월 8일
% z= height n t= time
for i=1:length(z)-1; % column of xx % total length of column d(i)=sqrt(abs(z(i+1,1)-z(i,1)).^2+abs(t(i+1,1)-t(i,1)).^2); %dist(s1,s2) = sqrt[(x1-x2)^2 + (y1 - y2)^2]; dmax(i)=sqrt((abs(z(i+1,1)-z(1,1)).^2+abs(t(i+1,1)-t(1,1)).^2)); for hx=round(linspace(0,len,fs));
% how to looping im stack here!!!
hxx(i)=hx(1,i+1)-hx(1,i); %ggggggggggggggggggggggggggggggggggggggggggg L=sum(d); %sum of distance between successive point a=mean(d); % average distance between successive point D=max(dmax); % diameter of curve of farthes distance between starting point into any other point n=double(L./a); % to form in double values den=double(D./L); % to form in double values k= (log10(n))./(log10(den)+log10(n)); end end

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


Guillaume
Guillaume 2015년 10월 8일
There are many ways to do split your data into frames of size 256. Which one is best probably depends on what you want to do with the frames.
What you still haven't explained is what you're planning to do with the leftover 34 elements.
Starting point:
waveheights = randi([1 100], 1, 450082); %input wave height
processingfun = @(frame) disp(frame); %some processing function
Option 1: split the data into a cell array, use cellfun (or a for loop) for further processing. The 34 leftover are a slight additional hurdle
splits = [ones(1, floor(numel(waveheights)/256))*256, rem(numel(waveheights), 256)];
waveframes = mat2cell(waveheights, 1, splits);
cellfun(processingfun, waveframes);
Option 2: reshape the data into a matrix. The 34 leftover have to be removed
waveheightshort = waveheights(1:end-rem(end, 256); %remove leftovers
waveframes = reshape(waveheightshort, 256, []); %each columne of waveframe is a frame
for frame = 1:size(waveframes, 2)
processingfun(waveframe(:, frame));
end
Option 3: just use loops.
for frame = 1:256:numel(waveheigts)
waveframe = waveheigt(frame:min(frame+255, end));
processingfun(waveframe);
end

카테고리

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