freq = 5.0; ampl = 2.0; [time, sine] = sinewave(freq, ampl, 1.5); if duration <= 1.0 plot(1000.0*time, sine); xlabel('Time [ms]'); else plot(time, sine); xlabel('Time [s]'); end ylim([-1.2*ampl 1.2*ampl]); ylabel('Sinewave'); title(sprintf('Frequency %g Hz', freq));