Can someone explain to me or translate this code for me in English please

1 view (last 30 days)
for sample=[1:300]
%%%%%% modeling output of the units U12
sample
for z=[1:5]
UF_U12(z,:)=(unifrnd(0,1,1,100));
UR_U12(z,:)=(unifrnd(0,1,1,100));
TTF_U12(z,:)=floor(-2940 * log(UF_U12(z,:)));
TTR_U12(z,:)=floor(-60*log(UR_U12(z,:)));
A_12(z,1:sum(TTF_U12(z,:)+TTR_U12(z,:))+100000)=ones;
for (i=1:100)
fst_one=find(A_12(z,:)==1);
fst_one(1);
A_12(z,fst_one(1):fst_one(1)-1+TTF_U12(z,i))=12;
A_12(z,fst_one(1)+TTF_U12(z,i):fst_one(1)+TTF_U12(z,i)-1+TTR_U12(z,i))=0;
end
U12_out=A_12(:,1:8736);
end
and the same with units U12 U20 U50 U76 U100 U155 U197 U350 U400
for j=[1:8736]
U12_total(j)=sum(U12_out(:,j));
U20_total(j)=sum(U20_out(:,j));
U50_total(j)=sum(U50_out(:,j));
U76_total(j)=sum(U76_out(:,j));
U100_total(j)=sum(U100_out(:,j));
U155_total(j)=sum(U155_out(:,j));
U197_total(j)=sum(U197_out(:,j));
U350_total(j)=sum(U350_out(:,j));
U400_total(j)=sum(U400_out(:,j));
end
U_total=U12_total+U20_total+U50_total+U76_total+U100_total+U155_total+U197_total+U350_total+U400_total;
  4 Comments
4hrm6
4hrm6 on 15 Dec 2022
Thank you for your answer
But I am trying to learn matlab by reading random codes and trying to analyze them and understand the written commands and what they indicate
I don't care what the code is used for and what values are inside
But I want to know what does each line mean... what does this commands mean... what does this sentence mean... and so on.. this is my question
Torsten
Torsten on 15 Dec 2022
First learn the MATLAB basics, then study complicated codes.
Here is a two-hours introductionary online course for free:

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!