How to retrieve the successive values from the given code

2 ビュー (過去 30 日間)
MINATI
MINATI 2020 年 1 月 12 日
コメント済み: MINATI 2020 年 1 月 12 日
syms k r a b
k=7;F = zeros(k,1);F(1)=0;F(2)=1;F(3)=a/2;
for r = 1:k
F(k+3)=(symsum((r+1)*F(r+1)*(k-r+1)*F(k-r+1),r,0,k) -symsum((k-r+1)*F(r)*(k-r+2)*F(k-r+2),r,0,k)...
-symsum((k-r+1)*G(r)*(k-r+2)*F(k-r+2),r,0,k)+(M+L)*(k+1)*F(k+1))/((1+b)*(k+1)*(k+2)*(k+3));
end
disp(F(1:7))
  2 件のコメント
Walter Roberson
Walter Roberson 2020 年 1 月 12 日
F = zeroes(k, 1,'sym');
But you need to rewrite the symsum. It is never possible to use a symbolic variable as a subscript. You should just calculate the expression in vectorized form and sum()
Even if using symbolic variables as an index were permitted, with each of your symsum going to k, you are trying to access up to F(k+q) in each symsum even though you have not defined past F(r+2)
MINATI
MINATI 2020 年 1 月 12 日

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by