how to creat sinusoidal single bump for disturbance
7 次查看(过去 30 天)
显示 更早的评论
Hi I need a sinusoidal single bump for road disturbance at certain frequency like this picture. but I don't know how to create it.
Thank you.
0 个评论
采纳的回答
Star Strider
2014-5-16
This is how I would do it:
% L = Length, A = Amplitude,
sinbump = @(L,A) A*(0.5+0.5*(sin(linspace(-pi/2,pi*3/2,25*L))));
B1 = sinbump(1, 1);
B2 = sinbump(5, 0.5);
figure(1)
subplot(2,1,1)
plot(B1)
grid
title('Amplitude = 1. Length = 25')
axis([0 150 0 1.5])
subplot(2,1,2)
plot(B2)
grid
title('Amplitude = 0.5. Length = 125')
axis([0 150 0 1.5])
I used L (relative ‘wavelength’) here. You will have to convert it to frequency, because while I understand about spatial frequency, I don’t know how you intend to define it. Adapt to do what you want.
The only part you need to keep constant is the definition of the function on the interval (-0.5*pi, 1.5*pi). Otherwise it won’t have the shape you want. Varying L simply changes the number of samples linspace generates, so lower frequencies = longer wavelengths = longer lengths of the vectors sinbump returns. You will have to account for this in zero-padding it so vectors with different bump frequencies will all be the same lengths, if that is important. Zero-padding it will also put it in the position you want on your simulated roadway. I chose 25 samples arbitrarily. Change that as you wish.
The plots simply demonstrate what various options of A and L do.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!