How to create a random and smooth varying rpm profile?
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi,
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);
figure()
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.
댓글 수: 0
채택된 답변
DGM
2022년 10월 19일
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
DGM
2022년 10월 19일
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.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Vibration Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!