Dear
i need help in get the output who solve the numbers by given formula and give output in vector form which have all data.....
x=[ 1 5 10 20 30 45];
n = numel(x); % number of elements in x
i=1;
for zzzz=1:n-1
b=x(i+1);
c=x(i);
wavelengthacceleration=[b-c]
i=i+1;
end
I need OUTPUT like
wavelengthacceleration = [4 5 10 10 15]
The above program show only final value of 15 in workspace.
Thank you

 채택된 답변

Walter Roberson
Walter Roberson 2019년 7월 25일

1 개 추천

wavelengthacceleration = diff(x) ;
With no loops needed

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품

릴리스

R2018b

태그

질문:

2019년 7월 25일

답변:

2019년 7월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by