Jennifer (jgalaway) wrote in ogipdx,
Jennifer
jgalaway
ogipdx

matlab code problems

Ok, I realize I have posted about this before and I am posting in a variety of engineering journals, but I'm really stuck here...I am having problems with the following code...

Here is the netlist I am working with:
R1 1 0 900
R2 1 2 550
R3 2 0 750
R4 3 0 2000
R5 3 4 2250
R6 4 0 195
R7 2 3 3000
I8 0 1 2.5E-3
I9 2 3 1.5E-3

Here is the code I am trying to use to form an admittance matrix...but I also can't figure out how to separate the R's and I's...
[element,n1,n2,val]= textread('hw1.txt', '%s%d%d%f')
Y=zeros(max(n1),max(n2))
m=1;
n=1;
k=1;
for i=n1(m),
for j=n2(m),
Y(i,j)=Y(i,j)+ 1/val(k))
end
end

I get the error message:
Subscript indices must either be positive integers or logicals.

What the hell does that mean??? Plus, how the heck am I able to search for an "R" or an "I" to populate 2 different matrices??? If someone could help me out I would be forever grateful!!!
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments