There is any function displacement

This array
I want find differential between the numbers then, i want find displacement
and thank u

답변 (1개)

Joseph Cheng
Joseph Cheng 2015년 5월 17일
편집: Joseph Cheng 2015년 5월 17일

0 개 추천

you can use the function diff() to perform this differential. so you'll have something like
da = diff(a); %this will get your your [4 5 ...]
then you can perform your da./a(1:end-1)*100.

댓글 수: 7

abduall hassn
abduall hassn 2015년 5월 17일
편집: abduall hassn 2015년 5월 17일
yes brother but this da/a(1:end-1)*100. not given correct ans
Joseph Cheng
Joseph Cheng 2015년 5월 17일
편집: Joseph Cheng 2015년 5월 17일
well then you did not explain it very well. this will give you the displacement that you asked for of each neighboring indexes, so by going diff(a) you get your first second third differential like you explained. Then you can divide by the original and multiply by the 100.
so if
da = 100*diff(a)./a(1:end-1)
is not what you are looking for please explain more
abduall hassn
abduall hassn 2015년 5월 17일
thank u brother now is ok
i used this data a=[1616400 1749524 23755514 160257 13653988 935134 15192144] i have done same u said bu i got problem step 1 da=diff(a) step2 da = 100*diff(a)./a(1:end-1)
da =
1.0e+003 * this is problem i dnt like to come because it change the ans
ans 0.0082 1.2578 -0.0993 8.4201 -0.0932 1.5246
i want remove this 1.0e+003 because change ans
Try executing this line of code before you do that:
format long g;
abduall hassn
abduall hassn 2015년 5월 19일
Brother if i have array more than one rows and columns like [ 56 78 6 88 67 77 64 93 60 70 22 34 29 45 15] How we can do it thank you and thank you
Joseph Cheng
Joseph Cheng 2015년 5월 19일
da = diff(a,[],2)./a read the documentation of the function diff() to see that by performing diff(a,[],2) we perform it in the correct dimension.

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

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

태그

아직 태그를 입력하지 않았습니다.

질문:

2015년 5월 17일

편집:

2016년 11월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by