Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Fs = 44100; % Sampling frequency in Hz
- T = 1; % Total duration of the signal in seconds
- f = 120; % Frequency of the oscillator
- t = 0:(1./Fs):(T - (1./Fs)); % Time vector
- p = 2.0 .* pi .* t; %Phase vector
- y = sin(f.*p);
- Fs = 44100; % Sampling frequency in Hz
- T = 1; % Total duration of the signal in seconds
- f0 = 1; % Start chirp at
- f1 = 120; % end chirp at (Better keep f1>f0)
- t = 0:(1./Fs):(T - (1./Fs)); % Time vector
- p = 2.0 .* pi .* t; %Phase vector
- y = sin(f0.*p + 2.*pi.*(((f1-f0)/(2.*T)).*t.^2));
- s = diff(f0.*p + 2.*pi.*(((f1-f0)/(2.*T)).*t.^2)); % Get the first derivative of phase to find the **rate of change**.
- r = f0.*p + 2.*pi.*(((f1-f0)/(2.*T)).*t.^2); % The phase as above.
- z = r(end) + cumsum(ones(1,T.*Fs).*0.017097); % A running sum of duration T.*Fs (samples).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement