A Loop problem

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

kalolibaby
Posts: 4
Joined: Sun Mar 03, 2013 7:37 pm

A Loop problem

Postby kalolibaby » Sun Mar 03, 2013 7:45 pm

Hello

I just want to form a state-space model with 5 loop. Reference to manual, each signal and state equation should have one covariance vector respectively. I formed program but it didn't work. Please tell me how I can fix it, thanks!

for !i=1 to 5
sspace tvp!i
tvp!i.append num!i=sv1!i*h+[var=exp(c((!i-1)*2+1))]
tvp!i.append @state sv1!i=sv1!i(-1)+[var=exp(c(!i*2))]
tvp!i.ml
next

Cheers.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: A Loop problem

Postby EViews Gareth » Sun Mar 03, 2013 7:55 pm

Hard to tell exactly without more details, but one thing that looks wrong is that you have:

Code: Select all

c(!i-1)
Which will yield C(0), which doesn't exist (EViews is 1-based, not 0-based).

kalolibaby
Posts: 4
Joined: Sun Mar 03, 2013 7:37 pm

Re: A Loop problem

Postby kalolibaby » Sun Mar 03, 2013 8:22 pm

Hard to tell exactly without more details, but one thing that looks wrong is that you have:

Code: Select all

c(!i-1)
Which will yield C(0), which doesn't exist (EViews is 1-based, not 0-based).
i just want to refine disturbance of signal and state equation with follows:
sspace1
c(1) c(2)
sspace2
c(3) c(4)
....

How i form like this way? Thnaks.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: A Loop problem

Postby EViews Gareth » Sun Mar 03, 2013 8:27 pm

Code: Select all

!coef1 = (!i-1)*2+1 !coef2 = (!i-1)*2+2

kalolibaby
Posts: 4
Joined: Sun Mar 03, 2013 7:37 pm

Re: A Loop problem

Postby kalolibaby » Tue Mar 12, 2013 6:12 pm

Code: Select all

!coef1 = (!i-1)*2+1 !coef2 = (!i-1)*2+2
I got it. Thanks vary much


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests