Error in TDMA gallery function

1 view (last 30 days)
Jenish Kodinariya
Jenish Kodinariya on 4 Apr 2019
clear,clc
x=[];
n=input('Number of total nodes:');
L=input('Enter the length of nodes:');
b=input('Enter cont/exp factor:');
sum=1.0;
a=input('Enter value of intial tem.');
z=zeros(n-3,1);
E=[a;z];
if (b>=0.90)&&(b<=1.10)
%Grid Generation
for i=1:n-2
sum=sum+b^i;
dx=(L/sum);
end
for k=2:n-1
x(1)=0;
x(k)=x(k-1)+(dx*b^(k-1));
x(n)=1;
end
fprintf('\n\n');
x=transpose(x);
disp(x)
%formation of TDMA
for i=2:n-2
q(i)=1+(x(i)-x(i-1));
end
else
fprintf('\n\n');
disp('please enter the value of cont./exp.factor between 0.90 and 1.10');
end
p=-1;
r=0;
X=full(gallery('tridiag',n-2,p,q,r))
T=inv(Tm)*E
tdam.JPG

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!