Can someone explain to me or translate this code for me in English please
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
Torsten
2022-12-15
First learn the MATLAB basics, then study complicated codes.
Here is a two-hours introductionary online course for free:
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!