how to creat sinusoidal single bump for disturbance
조회 수: 6 (최근 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!