Click here to Skip to main content
16,016,088 members

Comments by shweta89 (Top 11 by date)

shweta89 27-Mar-15 13:26pm View    
i tried it and will try again too.
i want the output that looks like symmetric matrix. by getting value from one matrix and frequency depend on vector.
is there any other method to make the block matrix. blockdiagonal matrix is easy to make in matlab. but not getting any function to make blockmatrix.

well thanks for your help. I am new in this coding field so i need some help.
shweta89 27-Mar-15 13:08pm View    
not getting the exact output. please tell me where I am wrong.
ss(1)=0;
for q=2:number+1
ss(q)=ss(q-1)+facility_units(q-1);
end
ss

dist=zeros(tu,tu);
for i=1:number
for j=1:number
if di(i,j)~=0 && i~=j && i
shweta89 27-Mar-15 13:04pm View    
Deleted
number=4
facility_units=[4 3 2 1]
tu=10

%d = randi(7,1) % The diagonal values
d=7;
t = triu(d.*rand(number),1) % The upper trianglar random values
M = t+t.'
di=zeros(number,number); % initialize with zeros
for i=1:number
for j=1:number
if M(i,j)>0 && M(i,j)<0.49 %if values lies between 0 to 0.49 than set it to 1
M(i,j)=1;
end
di(i,j)=round(M(i,j)); % round off the value to get distance matrix
end
end
di

tt=facility_units(1);
sss(1)=tt;
for q=2:number
sss(q)=sss(q-1)+facility_units(q);
end
sss

ss(1)=0;
for q=2:number+1
ss(q)=ss(q-1)+facility_units(q-1);
end
ss

dist=zeros(tu,tu);
for i=1:number
for j=1:number
if di(i,j)~=0 && i~=j && i
shweta89 27-Mar-15 13:03pm View    
I have already make a code for this but not getting the exact output. I tried it number of times. can you please check it and tell me where I am doing wrong thing. the code is in MATLAB. but the logic of C and MATLAB is same to make this.

number=4
facility_units=[4 3 2 1]
tu=10
d=7;
t = triu(d.*rand(number),1) % The upper trianglar random values
M = t+t.'
di=zeros(number,number); % initialize with zeros
for i=1:number
for j=1:number
if M(i,j)>0 && M(i,j)<0.49 %if values lies between 0 to 0.49 than set it to 1
M(i,j)=1;
end
di(i,j)=round(M(i,j)); % round off the value to get distance matrix
end
end
di

tt=facility_units(1);
sss(1)=tt;
for q=2:number
sss(q)=sss(q-1)+facility_units(q);
end
sss

ss(1)=0;
for q=2:number+1
ss(q)=ss(q-1)+facility_units(q-1);
end
ss

dist=zeros(tu,tu);
for i=1:number
for j=1:number
if di(i,j)~=0 && i~=j && i
shweta89 27-Mar-15 13:01pm View    
Deleted
I have already make a code for this but not getting the exact output. I tried it number of times. can you please check it and tell me where I am doing wrong thing. the code is in MATLAB. but the logic of C and MATLAB is same to make this.

number=4
facility_units=[4 3 2 1]
tu=10

d=7;
t = triu(d.*rand(number),1) % The upper trianglar random values
M = t+t.'
di=zeros(number,number); % initialize with zeros
for i=1:number
for j=1:number
if M(i,j)>0 && M(i,j)<0.49 %if values lies between 0 to 0.49 than set it to 1
<!--0--> M(i,j)=1;
end
di(i,j)=round(M(i,j)); % round off the value to get distance matrix
end
end
di

tt=facility_units(1);
sss(1)=tt;
for q=2:number
sss(q)=sss(q-1)+facility_units(q);
end
sss

ss(1)=0;
for q=2:number+1
ss(q)=ss(q-1)+facility_units(q-1);
end
ss

dist=zeros(tu,tu);
for i=1:number
for j=1:number
if di(i,j)~=0 && i~=j && i<j for="" l="ss(j-1)+1:ss(j)" m="ss(j)+1:ss(j+1)" dist(l,m)="di(i,j);" end="" dist<="" div=""> <div id="EditDialogPlaceholder"></div> <div id="ReplyDialogPlaceholder"></div>