how diff command works?
조회 수: 1 (최근 30일)
이전 댓글 표시
Respected Sir, I have following data.
-2.94000542962793 -0.000891548563348562
-3.08711094258045 -0.000486202607067662
-3.16733437274661 0.000246165485256576
-3.12671706767928 0.00102294399111758
-2.95793130914487 0.000749214351318326
-2.83431094117735 0.00309004687573728
-2.32445320668070 0.00366899717584366
-1.71906867266650 0.00439248318546055
-0.994308947065506 0.00491652606519422
-0.183082146308459 0.00463391434268762
0.581513720234998 0.00441428466119678
1.30987068933247 0.00436179962701698
2.02956762779027 0.00343887048751685
2.59698125823055 0.00324265720589084
3.13201969720254 0.00324830944034097
3.66799075485880 0.00297215741434881
4.15839672822635 0.00182233143477911
4.45908141496490 0.000300265443564988
4.50862521315313 -1.10444356313665e-07
4.50860698983434 -1.10444356313665e-07
left most is my original data and right most is diff of that data. Can you help me to know how it will give me this result?
Thaaks.
댓글 수: 2
Andrew Newell
2013년 6월 19일
What do you mean when you say that the right column is the diff of the left? The difference between the first two numbers is -0.1471, not -0.00089.
Jan
2013년 6월 19일
Showing only two vectors does not explain the relation between them. Please show us (by editing the original message), how you have created the right column. Otherwise there is an infinite number of possible way to obtain one dataset from another one.
답변 (1개)
Roger Stafford
2013년 6월 19일
편집: Roger Stafford
2013년 6월 19일
You have clearly created the rightmost column by taking the 'diff' of the left column and dividing by 165, and then duplicating the last element. Can you tell us why you have done this? Also I don't understand what it is you are asking. If you are attempting to approximate a derivative, you can get better results with matlab's 'gradient' function.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 File Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!