Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
thomas alogrithm

Subject: thomas alogrithm

From: asmat khan

Date: 12 Nov, 2010 13:30:23

Message: 1 of 2

i made a program for thomas alogrithm.can some body tell me is there any built in function for thomas alogrithm. TDMA is no more available in matlab .can somebody tell me other than TDMA. please
B=[2/3,2/3,2/3,2/3, 2/3,2/3]; %diagnol elements

C=[1/6,1/6,1/6,1/6,1/6,0]; %above diagnol elements
A=[0,1/6,1/6,1/6,1/6,1/6]; % below diagnol elements
F=[0,.2,.2,.2,.2,1];



    n=4
alpha(1)=B(1);
beta(1)=C(1)/alpha(1);
Y(1)=F(1)/alpha(1)
for i=2:n
 alpha(i)=B(i)-A(i)*beta(i-1)
 Y(i)=F(i)-A(i)*Y(i-1)/alpha(i);
for i=1:n
 X(n)=Y(n)
end
 nu=n-1;
 
     
   
       for i=1:nu;
     j=n-1;
     X(j)=Y(j)-beta(j)*X(j+1);
 end
end

Subject: thomas alogrithm

From: Sean

Date: 12 Nov, 2010 14:21:04

Message: 2 of 2

"asmat khan" <asmat.k@hotmail.com> wrote in message <ibjfhf$7fr$1@fred.mathworks.com>...
> i made a program for thomas alogrithm.can some body tell me is there any built in function for thomas alogrithm. TDMA is no more available in matlab .can somebody tell me other than TDMA. please
> B=[2/3,2/3,2/3,2/3, 2/3,2/3]; %diagnol elements
>
> C=[1/6,1/6,1/6,1/6,1/6,0]; %above diagnol elements
> A=[0,1/6,1/6,1/6,1/6,1/6]; % below diagnol elements
> F=[0,.2,.2,.2,.2,1];
>
>
>
> n=4
> alpha(1)=B(1);
> beta(1)=C(1)/alpha(1);
> Y(1)=F(1)/alpha(1)
> for i=2:n
> alpha(i)=B(i)-A(i)*beta(i-1)
> Y(i)=F(i)-A(i)*Y(i-1)/alpha(i);
> for i=1:n
> X(n)=Y(n)
> end
> nu=n-1;
>
>
>
> for i=1:nu;
> j=n-1;
> X(j)=Y(j)-beta(j)*X(j+1);
> end
> end

The above code doesn't run because you try to reference Y(4) when Y is only 2 elements long. If you get this code working, we can maybe help you vectorize it.

Tags for this Thread

No tags are associated with this thread.

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.

Contact us