Try this instead, no for loop needed
fs = 100000000 dt = 1/fs StopTime = 5E-6 Fc = 5E6; t = 0:dt:StopTime y = nan(size(t)) y(t<1E-6) = 2*sin(2*pi*Fc*t(t<1E-6)) y(~(t<1E-6)) = 0 plot(t,y)
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!