Using diff function with a rate.

조회 수: 5 (최근 30일)
Abe
Abe 2014년 12월 26일
댓글: Jan 2014년 12월 29일
forceVector = [1:32]';
cellDims = [0 diff([1 4 8 16])];
peakData = mat2cell(forceVector,cellDims);
------------------------------------------------- This is a very nice code, but please I want to work with it by rate for example the percentage going up if the string of numbers become bigger. More precisely, we have string its length is 2^5 so the string will be divided into 5 parts, each part has different rate (1/5, 2/5, 3/5, 4/5 and 5/5). If you have any ideas about this that will be helpful.
  댓글 수: 2
Image Analyst
Image Analyst 2014년 12월 26일
So your string is 2^5 or 32 characters long. How do you divide that into 5 parts? And diff() subtract numbers - the nth element from the (n+1)st element. So why are you doing this on strings instead of numbers? What does subtracting the ASCII values of the characters do for you? And what do you mean by rate? Rate means frequency. I'm getting confused as to the rates , like do you want to subtract the nth element from the (n+5)th element for portions of the array in the 5th chunk?
It's very confusing so please clarify, preferably with an actual string of 32 characters long. Show us what the 5 parts are, and how you would like the diff() command to work (what elements get subtracted), and what the final output should be.
Jan
Jan 2014년 12월 29일
@Image Analyst: I believe that "string" means "vector" actually.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Signal Operations에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by