Thread Subject:
Speeding up a matlab code

Subject: Speeding up a matlab code

From: Yong Hoon

Date: 21 Jul, 2012 13:56:16

Message: 1 of 3

I have a problem of computing speed for this code.
I appreciate if someone helps me to reduce the computing speed.

% the size of K is usually (100000x100000).
NT = 40401;
NC = 43;
%% Internal Nodes
KII=[];
for i= 2*NC+1:2*NT
for j= 2*NC+1:2*NT
KII(i-2*NC,j-2*NC)=K(i,j);
end
end

Subject: Speeding up a matlab code

From: Bruno Luong

Date: 21 Jul, 2012 15:03:09

Message: 2 of 3

"Yong Hoon " <jang.yonghoon@gmail.com> wrote in message <juece0$ai8$1@newscl01ah.mathworks.com>...
> I have a problem of computing speed for this code.
> I appreciate if someone helps me to reduce the computing speed.
>
> % the size of K is usually (100000x100000).
> NT = 40401;
> NC = 43;
> %% Internal Nodes
> KII=[];
> for i= 2*NC+1:2*NT
> for j= 2*NC+1:2*NT
> KII(i-2*NC,j-2*NC)=K(i,j);
> end
> end

i= 2*NC+1:2*NT;
j= 2*NC+1:2*NT;
KII=K(i,j);

% Bruno

Subject: Speeding up a matlab code

From: Yong Hoon

Date: 22 Jul, 2012 21:24:15

Message: 3 of 3

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <juegbd$n4u$1@newscl01ah.mathworks.com>...
> "Yong Hoon " <jang.yonghoon@gmail.com> wrote in message <juece0$ai8$1@newscl01ah.mathworks.com>...
> > I have a problem of computing speed for this code.
> > I appreciate if someone helps me to reduce the computing speed.
> >
> > % the size of K is usually (100000x100000).
> > NT = 40401;
> > NC = 43;
> > %% Internal Nodes
> > KII=[];
> > for i= 2*NC+1:2*NT
> > for j= 2*NC+1:2*NT
> > KII(i-2*NC,j-2*NC)=K(i,j);
> > end
> > end
>
> i= 2*NC+1:2*NT;
> j= 2*NC+1:2*NT;
> KII=K(i,j);
>
> % Bruno


Thanks a lot!

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us