필터 지우기
필터 지우기

How to divide a part of array to the another part of it?

조회 수: 1 (최근 30일)
Ege Tunç
Ege Tunç 2019년 12월 3일
답변: Fabio Freschi 2019년 12월 3일
For example, i had a array has 28 numbers(non integer), and since these values depending on other variable and changing, i want to find first 1/5 part of it divided to last 1/5. The sum of the first 5 terms over sum of the last 5 terms.
Basically, i'll plot the this ratio over the other variable.
Here's my array for example:
psi2=[0.6742 0.6784 0.6844 0.6912 0.6975 0.7020 0.7061 0.7122 0.7207 0.7325 0.7486 0.7646 0.7728 0.7715 0.7611 0.7435 0.7262 0.7135 0.7041 0.6972 0.6922 0.6873 0.6819 0.6772 0.6739 0.6728];
and i got energy number
E2=some changing integer
i need the ratio
T=psi2(first5)/psi2(last5)
and plot(T,E2)

채택된 답변

Fabio Freschi
Fabio Freschi 2019년 12월 3일
T = psi2(1:5)./psi(end-4:end);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by