필터 지우기
필터 지우기

Multiply value with value in previous position in Matlab cell

조회 수: 3 (최근 30일)
Phat Pumchawsaun
Phat Pumchawsaun 2017년 3월 10일
댓글: Phat Pumchawsaun 2017년 3월 10일
Hi,
I would like to create an equation using for loop for multiply current values with previous position but my code does not work. Please give some guideline for me. I attached my code (data_test01.m) and excel data (data.xls). The formula in excel is example that is the same thing I want to do in matlab.

채택된 답변

the cyclist
the cyclist 2017년 3월 10일
The problem is that in this expression
Phi_wp(n,:)
n=0 the first time through the loop, and the elements Phi_wp(0,:) do not exist, because MATLAB has 1-based indexing.
This is a common situation. Typically you just have to handle that first case before the loop, and then start your loop from m = 2.
  댓글 수: 1
Phat Pumchawsaun
Phat Pumchawsaun 2017년 3월 10일
Thank so much.
I tried that but it seems like the answer is not correct comparing to the value in last attached excel file.

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

추가 답변 (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