How to shrink time scale for discrete signal?

2 views (last 30 days)
%if
bits = [1,0,1,1,0,0,0,1];
% Mapping
for a=1:length(bits)
if bits(a) == 1
bit(a) = 5;
else
bit(a) = -5;
end
end
i = 1;
t = 0:0.01:length(bits);
for b=1:length(t)
if t(b) <= i
y(b) = bit(i);
else
y(b) = bit(i);
i = i+1;
end
end
plot(t,y);
end
I am trying to change the duration of 1 bit from 1s to 1us and the scale would be 0 to 8us with a step of 1e-8. I am getting an error if I do it using this method and if I specify my own time scale it will only print the first value that goes from 0 to 1. Any ideas???

Answers (0)

Community Treasure Hunt

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

Start Hunting!