How can I modify values of eye
3 views (last 30 days)
Show older comments
I am trying to code huckles determinant, and was able to get the matrix for cyclic hydrocarbons and lineal ones, however, I have not been able to do it for chains of carbons with substituents like (carbon 1, has 1 ch3 substituent)... I tried changing the values specifically of the eye matrix, but it just keeps on adding a two for every value instead of only the 6th and 7th value of a 5 carbon chain. I tried using A(r,c) = 2.... sorry the inputs are in spanish... Please help if you can!
disp('Hueckels determinante ')
pause(1)
s = menu('Hidrocarburos','Ciclicos', 'Lineales', 'Substituidos');
c = input('Cantidad de carbonos del Hidrobarburo ');
switch s
case 1
A = -eye(c);
A(1,c) = 1;
A(c,1) = 1;
v = ones(1,c-1);
A(logical(diag(v,1)))= 1;
A(logical(diag(v,-1)))= 1
case 2
A = -eye(c);
v = ones(1,c-1);
A(logical(diag(v,1)))= 1;
A(logical(diag(v,-1)))= 1
case 3
d = input('Cantidad de susbtituyentes ' );
for K = 1:d
disp(['En cual carbono: ' ,num2str(K),])
m(K) = input(' ');
end
c = input('Cantidad de carbonos del Hidrobarburo ');
x = ((c+1):(c+d));
A = -eye(c);
v = ones(1,c-1);
A(logical(diag(v,1)))= 1;
A(logical(diag(v,-1)))= 1
A(m,x) = 2
A(x,m) = 2
end
6 Comments
Guillaume
on 23 Jul 2018
@Jhanna, To make it easier to understand what you, give us (using valid matlab syntax) and example of input and the desired output from that.
Answers (1)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!