Translate sine coding? Need understanding

1 visualización (últimos 30 días)
Nicholas
Nicholas el 19 de Sept. de 2022
Editada: Torsten el 19 de Sept. de 2022
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

Respuestas (1)

Steven Lord
Steven Lord el 19 de Sept. de 2022
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."

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by