Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to create a new vector by applying an operation(s) to a current vector. The new vector will depend on elements created previously in that same vector (recursive)

조회 수: 1 (최근 30일)

I have the columns of n, and h1[n] already produced. Now what I want to produce is the column h2[n].

To avoid wasting your time, I've simplified the structure of h2[n] in the picture. I know the first step is to generate h2[0] because all of the other elements in h2[n] depend on it. Secondly, for n>=1, the "components pairs" are such that h1[k]*h2[m] where k+m=n and there are n-number of component pairs in each h2[n].

Ex1. n=1. h2[1] has one "component pair:" h1[1]*h2[0] where k+m=1.; Ex2. n=2. h2[2] has two "component pairs:" h1[1]*h2[1]+h1[2]*h2[0] where each k+m=2=n.

The Goal: How to produce h2[n] of dimensions 41x1 (n=0:1:40) by manipulating the elements in h1[n] and the previously computed elements in h2[n] (recursion)?

  댓글 수: 1
Sudarshan Kolar
Sudarshan Kolar 2017년 4월 25일
Hello James,
Try to come up with a general algorithm for h[n]. You will have to use loops. Once you have the basic code with loops, try to vectorize your script.
Let me give you an example:
%%x(n) = A*x(n-1);
x = zeros(100,1);
for i = 1:10
x(i+1) = A*x(i);
end
Sudarshan

답변 (0개)

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by