finding a vector variable from an equation

Hi everyone,
I have an equation equal to zero, in this equation I have 'g' how is a vector I am tring to find.
my equation:
g(2:end)*s - g(1:end-1) == 0
s- is a known scalar
g- is a 100x1 vector that I want to find
I tired usying smys, smy and solve but couldn't solve what 'g' is.
Thanks in advance.

1 件のコメント

John D'Errico
John D'Errico 2020 年 10 月 6 日
Will you please stop asking the same question?

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 10 月 6 日

0 投票

Your equation seems to be equivalent to . You need an initial value to solve this equation.
g = zeros(1, 100);
g(1) = 10; % initial condition
s = 0.5
for i = 2:100
g(i) = 1/s*g(i-1)
end
Or for this particular equation, following will also work
g = (1/s).^(0:99)*10

この質問は閉じられています。

タグ

質問済み:

2020 年 10 月 6 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by