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] Attempted to access F2(6); index must be a positive integer or logical.

Status
Not open for further replies.

keremcant

Member level 5
Joined
Dec 25, 2009
Messages
87
Helped
6
Reputation
12
Reaction score
5
Trophy points
1,288
Activity points
1,910
I am trying to create an array inside a for loop and then I will plot it in MATLAB. bu I am tring to do it by incrementing the variable by 0.01 at one time. like this:

Code:
for w = 0.01:0.01:20
      F2(100*w) = G/abs(w^4 - C*G*w^2 + G);
end

it gives me the error : Attempted to access F2(6); index must be a positive integer or logical.

this seems silly because 6 is a positive integer index and also it can make the code work until 6 but at 6 it gives an error

what am I doing wrong??

thanks in advance
 

I think it is a matlab bug or something that i dont know. Try to convert index value to unsigned int as follows:

for w = 0.01:0.01:20
F2(uint32(100*w)) = G/abs(w^4 - C*G*w^2 + G);
end

I guess this conversion solves your problem.

Regards,
ALPER USLU
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top