Notation problem: Defining an equation using parenthesis.

Hi all,
I am having the following problem and I'm not sure it has a solution:
I am running the following equations within a 'for loop'.
Wf = [];
for i = 1:29
Wf = [Wf,SFC*T*(disp(i)/V1)];
W1(i+1) = W1(i)-Wf(i);
end
I have defined Wf(i) using parenthesis and I want to know if there is a way I can define W1(i+1) in the same manner.
Thanks in advance

回答 (1 件)

Image Analyst
Image Analyst 2014 年 10 月 15 日

0 投票

Well sure, you did it already. You just need to make sure that Wf(1) - the first element - has been defined before you assign Wf(i+1).
However I am worried about disp(i). It seems you are using an array call disp that somehow gets assigned before the loop. disp is a built-in function so it's a very bad idea to use a variable with the same name as any built-in function.

1 件のコメント

Zena Assaad
Zena Assaad 2014 年 10 月 15 日
編集済み: Zena Assaad 2014 年 10 月 15 日
Thanks that's a good tip I'll be sure to change it. But I need to define 'W1' not 'Wf' in parenthesis form and I'm confused how to do that when I'm working with W1(i+1)

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

質問済み:

2014 年 10 月 15 日

編集済み:

2014 年 10 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by