f=zeros(1,M);
for i=1:M
f(i)=fd+((1+m(i)*r)/2)*f_delta;
f(i)=fd-((1+m(i)*r)/2)*f_delta;
end
I need to save both values for the addition and subtraction.
Thanks in advance.

 채택된 답변

Star Strider
Star Strider 2020년 2월 28일

1 개 추천

Try this:
f=zeros(2,M);
for i=1:M
f(:,i)=[fd+((1+m(i)*r)/2)*f_delta; fd-((1+m(i)*r)/2)*f_delta];
end
That saves them as different rows of a (2xM) matrix.

댓글 수: 2

Qasim Mohammed
Qasim Mohammed 2020년 2월 28일
Thanks, it was helpful!
I need then as two columns, I transposed them.
Star Strider
Star Strider 2020년 2월 28일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

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

태그

질문:

2020년 2월 28일

댓글:

2020년 2월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by