필터 지우기
필터 지우기

for loop in equation

조회 수: 2 (최근 30일)
Kutru biladi
Kutru biladi 2015년 7월 22일
답변: Star Strider 2015년 7월 22일
Yo Volks, i am new in programming. i want to apply for loop in the equation 'phi_acc' which goes from '1 to nsamples' and after that want to put it in the phi equation.
phi_sync = rand(1,nsamples);
phi_acc = rand(1,nsamples);
phi = phi_sync(nsamples) + Phi_acc(nsamples);

채택된 답변

Star Strider
Star Strider 2015년 7월 22일
The code you posted will take the last values of ‘phi_sync’ and ‘phi_acc’ to calculate ‘phi’. (Also, MATLAB is case-sensitive, so ‘Phi_acc’ is a different variable from ‘phi_acc’, and will throw an error if you haven’t defined it.)
If you want to add the two vectors of the same size, just use:
phi = phi_sync + phi_acc;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by