How to plot this signal?
Info
This question is closed. Reopen it to edit or answer.
Show older comments
Hi there,
For this problem, I need to plot the function below. Its main idea to generate a random road profile by adding together sine waves of different frequencies and amplitudes in a chosen frequency range.
What I'm facing trouble with is the following:
1- How to express the sum of series in this equation
2- How to randomly generate the phase angle and how to implement it in the equation
3- What does "(K) the number of time samples" means and how to use it in substituting (tk) in the sin function.
Excuse me, I'm still a beginner in MATLAB so, I would be grateful for any help. Thanks in advance.
:
The reference:
Chapter 3
:

3 Comments
KSSV
on 26 Jul 2017
What you have attempted?
Ennio Condoleo
on 27 Jul 2017
I am supposing this is a homework, so I would not like to provide you the answer directly. Here you have only some hints: - define t as a vector by using "linspace" function (help linspace) - assign the constants as : "X = value"; - use "randn" or "rand" to generate a random number see the help)
I want to propose an example, if it is useful:
df = 0.5; & step freq Hz
fmin = 0.5; % min freq Hz
fmax = 10; % max freq HZ
f = fmin:df:fmax; % freq vect
ph = rand(length(f),1);
B = ...
U = ...
n1 = ...
c = 2*B*U^(n1-1);
% define all the variables required
Y = @(t,fj,pj) sqrt(c*df/fj^n1).*sin(2*pi*fj.*t+pj);
t = linspace(0,6,3042);
Yvalue = 0;
for j = 1:length(f)
Yvalue = Yvalue + Y(t,f(j),ph(j));
end
Try the code and edit it. I have written fastly!!!
mahmoud
on 28 Jul 2017
Answers (0)
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!