How to create a sine wave with variable frequency - Simulink
19 views (last 30 days)
Show older comments
HF on 8 Dec 2020
Commented: Mathieu NOE on 13 Dec 2020
I have the following problem. I have a set of data of my vehicle and need the acceleration data in the shape of a sine wave. The sine wave is then used to include some bearing faults. I could compute for every time step the frequency based on the velocity, which then can be used in the further steps.
Does anyone has an idea in how to create a sine wave with various frequency?
Thank you in advance!
Mathieu NOE on 8 Dec 2020
if you have the frequency at each time step, you can also calculate the angular increment at each time step : d_theta = 2*pi*freq*dt.
Then you simply need to integrate it (do a cumulative sum, modulo 2pi) to get the angle, then apply sin function.
More Answers (1)
Rafael Hernandez-Walls on 8 Dec 2020
something like this: (?)
Mathieu NOE on 13 Dec 2020
here a demo for a sinus log sweep
% log sweep demo
f1 = 50; % start freq
f2 = 200; % stop freq
Fs = 1e3; % sampling frequency
duration = 30; % s
dt = 1/Fs;
samples = floor(duration*Fs)+1;
t = (0:dt:(samples-1)*dt);
log10_freq = linspace(log10(f1),log10(f2),samples);
freq = 10.^log10_freq;
omega = 2*pi*freq;
angle_increment = omega.*dt;
angle = cumtrapz(angle_increment); % angle is the time integral of omega.
signal = sin(angle);
Find more on Signal Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!