필터 지우기
필터 지우기

How can I add the elements ascending in this code

조회 수: 1 (최근 30일)
almohanned alsufyani
almohanned alsufyani 2023년 3월 15일
편집: Voss 2023년 3월 15일
Mf=6.480554950317725e+03;
y=0.005338551179592;
D0=Mf*y; % Product of 1st stage
D(1)=D0;
M=Mf;
for c=2:15 % Product profile
D(c)=y*M*(1-y)^(c-1);
end
____
By the previous code the product of D will be a matrix of size 1*15 (1x15 double)
Now I want to apply the following equation, which is based on a cumulative summation of the values of D :
B1=Mf-D1
B2=Mf-(D1+D2)
B3=Mf-(D1+D2+D3)
B4=MF-(.....)
Up to B15

답변 (1개)

Voss
Voss 2023년 3월 15일
B = Mf-cumsum(D);

카테고리

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

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by