How to create a random and smooth varying rpm profile?

5 Ansichten (letzte 30 Tage)
Kalasagarreddi Kottakota
Kalasagarreddi Kottakota am 19 Okt. 2022
Kommentiert: DGM am 19 Okt. 2022
I am trying to create an rpm profile with rpm- varying between 1190 rm to 1210 rpm . Could someone help me on how to create it.
clear all
close all
fs= 10000; % sampling frequency
dt = 1/fs;
T = 1; % total time
t = 0:dt:T; % time vector
rpm = 1200*ones(length(t),1)+ randn(length(t),1);
plot(t,rpm); xlabel('s'); ylabel('rpm')
I tried above by adding random noise and it did not work. I am trying to create the below type of rpm profile.

Akzeptierte Antwort

DGM am 19 Okt. 2022
Filter the rpm signal. Depending on what toolboxes you have, there are a lot of tools you could use. I'm just going to use a very rudimentary approach without anything special.
fs= 10000; % sampling frequency
dt = 1/fs;
T = 1; % total time
t = 0:dt:T; % time vector
% a random vector
rpm = randn(length(t),1);
% filter the vector
ft = 0.05; % this scales the filter width
R = floor((ceil((ft*fs*5-1)/2)*2+1)/2); % this is always even
x = -R:R; % so this is always of odd length
fk = exp(-(x/(1.414*ft*fs)).^2); % a 1-D gaussian
rpm = conv(rpm,fk,'same'); % apply LPF
% scale/translate the vector
rpmrange = [1190 1210];
rpmrange0 = [min(rpm) max(rpm)];
rpm = (rpm-rpmrange0(1))/range(rpmrange0); % normalize
rpm = rpm*range(rpmrange) + rpmrange(1); % rescale
% show it
plot(t,rpm); xlabel('s'); ylabel('rpm')
  2 Kommentare
DGM am 19 Okt. 2022
The Signal Processing Toolbox is probably the most relevant here.
In the script, R is the half-width of the filter kernel. R is a function of fs*ft, which is what I used as the std deviation of the gaussian. The goal there is simply to create a filter that's wide enough to include a fair amount of the tails on the gaussian. In this case, the scaling factor was 5. A factor less than 5 would truncate more of the tails. The rest of the calculation of R is just to make sure that the result is an even integer.
FK doesn't have to be a gaussian. That's just what I chose to use. It could be a box or any other window function. Since the output of the filter gets scaled anyway, any normalization of the filter kernel doesn't have any effect. Notice that I didn't sum-normalize the gaussian.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by