Continue to Site

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.

[SOLVED] Matlab error - not a valid target for an assignment.

Status
Not open for further replies.

vipinlal

Full Member level 6
Joined
Mar 8, 2010
Messages
357
Helped
76
Reputation
152
Reaction score
60
Trophy points
1,308
Location
India
Activity points
3,191
Code:
 realW = 2.0*cos(2.0*pi*20/2001);
imagW = sin(2.0*pi*20/2001);
y = 0;
d1 = 0.0;
d2 = 0.0;
N=2001;
for n= 1:N
  {
    y  = x(n) + realW*d1 - d2;
    d2 = d1;
    d1 = y;
  }
end 
resultr = 0.5*realW*d1 - d2;
resulti = imagW*d1;

I am getting the following error on the below code,please help..

??? y = x(n) + realW*d1 - d2;
|
Error: The expression to the left of the equals sign is not a valid target for
an assignment.
 

Code:
 realW = 2.0*cos(2.0*pi*20/2001);
imagW = sin(2.0*pi*20/2001);
y = 0;
d1 = 0.0;
d2 = 0.0;
N=2001;
for n= 1:N
  {
    y  = x(n) + realW*d1 - d2;
    d2 = d1;
    d1 = y;
  }
end 
resultr = 0.5*realW*d1 - d2;
resulti = imagW*d1;

I am getting the following error on the below code,please help..

??? y = x(n) + realW*d1 - d2;
|
Error: The expression to the left of the equals sign is not a valid target for
an assignment.

you did not define what is x in the program
 

Sorry for the dumb question guys.. The problem wasnt with the definition of 'x'. I removed the brackets( { } ) after the 'statement' and it worked..
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top