Problem generating a randomized signal
显示 更早的评论
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 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!