Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

implementing this equation in matlab

Status
Not open for further replies.

serhannn

Member level 4
Joined
Sep 28, 2010
Messages
69
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Activity points
1,939
I have to implement the following equation in matlab.. I am trying to do it using a for-loop but I get an error since the initial value of L=0.
How else can I implement it?

The equation is:
eqn.jpg
The code I'm using and getting an error:
Code:
for i=1:L
      delta = s(k) - lambda_prev(1+i)*(s(k-i))';  
end
 

enjunear

Advanced Member level 3
Joined
Dec 21, 2010
Messages
960
Helped
309
Reputation
618
Reaction score
303
Trophy points
1,343
Location
USA, midwest
Activity points
9,749
Make your for loop i=0:L
As long as you aren't calling or assigning to an array element zero, like s(0)... then your code should work.

Additionally, you could shift everything by 1, making the loop run 0 to L, but where ever you have "i", change it to "i+1", so the first time through the loop you'll always have i+1 give you a 1, and not a 0.

Without seeing more of your code, its tough to say which method will work best for your situation.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top