This repository has been archived on 2021-05-17. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
scientificComputing/programming/exercises/sinewave.m
2016-11-22 09:26:50 +01:00

13 lines
383 B
Matlab

function [time, sine] = sinewave(freq, ampl, duration)
% compute sine wave with time axis
% freq: frequency of the sinewave in Hertz
% ampl: amplitude of the sinewave
% duration: duration of the sinewave in seconds
% returns:
% time: vector of time points
% sine: corresponding vector with the sine wave
step = 0.01/freq;
time = 0:step:duration;
sine = ampl*sin(2*pi*freq*time);
end