how to creat sinusoidal single bump for disturbance

6 ビュー (過去 30 日間)
md
md 2014 年 5 月 16 日
コメント済み: marco villarreal 2019 年 10 月 10 日
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.

採用された回答

Star Strider
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.
  1 件のコメント
marco villarreal
marco villarreal 2019 年 10 月 10 日
Funciona muy bien. Saludos!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by