Translate sine coding? Need understanding
1 回表示 (過去 30 日間)
古いコメントを表示
Good afternoon, Im trying to gain a better understanding of this code. Could anyone help translate it for me?
width = 1920;
height = 1080;
T = linspace(0,1,width);
brightness = 126;
f = 10;
HorLine = uint8((sin(2*pi*f*T)+1)*0.5*brightness);
img = repmat(HorLine,height,1);
imshow(img)
Im new to MATLAB so please dont leave any detail out lol
0 件のコメント
回答 (1 件)
Steven Lord
2022 年 9 月 19 日
To start off, I suggest you start with the free MATLAB Onramp tutorial to quickly learn the essentials of MATLAB.
Then work your way through the code, line by line, annotating it with notes (written as comments) about the purpose of each function call. You'll need to work from the innermost set of parentheses outward.
% T represents ...
T = linspace(0,1,width);
If you encounter a function whose purpose you're unsure about, call doc on the function name.
If after reviewing the documentation you're still unsure of what a particular line is doing, you should have enough information about what the code before it is doing to be able to ask a more focused question about that line. "The inputs to this call are T, which represents <explain what T is>, and Q, which represents <explain Q>. But I'm not sure why this line is calling <some function> on T and Q."
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!