I wanted to use script to create a new matrix from existing one. The first row of the new matrix equals to the first row of the existing matrix and the second column except for entry (1,2)equals to the negative of that column of the existing matrix.And remaining entries be what described in the script. I get error message that : Unable to convert expression into double array. Error script (line 8) a(i,j)=m(i,j). Please help me find out what's going wrong with my code. Thanks you!
clearsyms n v pj pk dm=[1-d^2,1,(1-d)*d,d,-d,1;d*(1-d),d,(1-d^2),1,-d,1;-(1-d)*n,-v-pj,-(1-d)*n,-v-pk,v+pj+pk,0]a=zeros(3,6)for i=1:3, for j=1:6 if i==1 a(i,j)=m(i,j) elseif i~=1&j==2 a(i,j)=-m(i,j); else a(i,j)=m(i,j)-(m(1,j)*m(i,2))/a(1,2); end endend
Best Answer