Using MatLab write a code for scaled partial pivotingSolutio

Using MatLab, write a code for scaled partial pivoting

Solution

here is the code for scaled partial pivoting

function [B pr]=spp(A,b)

B=[A b];

[n np1]=size(B);

pr=1:1:n;

s=max(abs(A\'))\';

for i=1:n

[v ind]=max(abs(B(i:n,i))./s(i:n));

p=i+ind-1;

[pr(i) pr(p)]=swap(pr(i),pr(p));

[B(i,:) B(p,:)]=swap(B(i,:),B(p,:));

[s(i) s(p)]=swap(s(i),s(p));

for j=i+1:n

d=B(j,i)/B(i,i);

B(j,:)=B(j,:)-d*B(i,:);

end

end

return

function [a,b]=swap(a,b)

temp=a;

a=b;

b=temp;

return

Using MatLab, write a code for scaled partial pivotingSolutionhere is the code for scaled partial pivoting function [B pr]=spp(A,b) B=[A b]; [n np1]=size(B); pr

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site