I studied the following for forming a pulse train in Matlab:
f=10; %frequency of the impulse in Hz
fs=f*10; % sample frequency is 10 times higher
t=0:1/fs:1; % time vector
y=zeros(size(t));
y(1:fs/f:end)=1;
plot(t,y);
I'm trying to understand the following 2 operations:
1.
t=0:1/fs:1; % time vector
What does it do?
2.
y(1:fs/f:end)=1;
What is the result of 1:fs/f:end ?
Thanks in advance!
f=10; %frequency of the impulse in Hz
fs=f*10; % sample frequency is 10 times higher
t=0:1/fs:1; % time vector
y=zeros(size(t));
y(1:fs/f:end)=1;
plot(t,y);
I'm trying to understand the following 2 operations:
1.
t=0:1/fs:1; % time vector
What does it do?
2.
y(1:fs/f:end)=1;
What is the result of 1:fs/f:end ?
Thanks in advance!