# Problem generating a randomized signal

2 views (last 30 days)
Sarah on 20 Feb 2013
I want to create a zero baseline signal that extends for some time t. Throughout the duration of this signal, I would like to have 3000 randomized sinusoidal excitations. By randomized, I mean in terms of frequency, amplitude, width, and location of the event.
I'm not exactly sure how to create this. I created three randomized vectors using the rand function, one for abnormal amplitude, frequency, and width. However, I'm not sure how to specify the randomized location of each excitation. I have the following code so far:
clear all; clc;
addpath(genpath(pwd));
Fsam = 1000; %Sampling Frequency
YNo = 10; %Number of years
ENo = 3000; %Number of abnormal excitations
%Abnormal Signal Parameters
%%%%%%%%%%
This generates a randomized vector for Amplitude, Frequency, and Width of the abnormal excitations. The randomized values are rounded to the nearest integer
%%%%%%%%%%
a = 0;
b = 10;
Rand.AbAmp = a + (b-a).*rand(1,ENo);
Rand.AbFreq = a + (b-a).*rand(1,ENo);
Rand.AbWid = a + (b-a).*rand(1,ENo);
Rand.AbAmp = round(Rand.AbAmp);
Rand.AbFreq = round(Rand.AbFreq);
Rand.AbWid = round(Rand.AbWid);
%Time Parameters
T.Start = 0; %Time Start
T.End = 365*YNo; %Time End (years)
T.Step = 1/Fsam; %Sampling rate
Time.Ref = T.Start:T.Step:T.End; %Time
%Abnormal Signal Creation
Sig1 = Ab.Amp*sin(Ab.Freq*2*pi*Ab.Time + Ab.Phase);
Thanks for your help!
##### 1 CommentShow -1 older commentsHide -1 older comments
Sarah on 20 Feb 2013
Here is an example of the signal I would like to create:
Here, I created three sinusoidal excitations. I specified the amplitude, frequency, location, and width of each excitation. However, I would like the amplitude, frequency, and width of the sinusoidal excitations to be random. Also, I would like the location to be random. I would like 3000 events. I'm not sure how to create the entire signal...so that is what I need help with. I hope this makes things more clear.

Sign in to comment.

### Answers (1)

Sarah on 20 Feb 2013
Here is an example of the signal I would like to create:
Here, I created three sinusoidal excitations. I specified the amplitude, frequency, location, and width of each excitation. However, I would like the amplitude, frequency, and width of the sinusoidal excitations to be random. Also, I would like the location to be random. I would like 3000 events. I'm not sure how to create the entire signal...so that is what I need help with. I hope this makes things more clear.
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

### Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!