Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

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 visualización (últimos 30 días)

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 comentario
Sudarshan Kolar
Sudarshan Kolar el 25 de Abr. de 2017
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

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by