Creating Sine wave with random values
조회 수: 31 (최근 30일)
이전 댓글 표시
Hello All,
I'm trying to introduce sine signal as false information to my system. Now presently, I have this siganl with values in array like
I= [6 16 6 16 75 1 22 6 6 6 6 22 25 25 25 25 23 5 5 16 9 9 9 9];
These are 24 values, I ploted this values and calculated the prices in such way that price for each value is determined. Now I wanted to introduce a sine wave signal as a fault signal, the problem is how to get only 24 valus like these discrete values for sine wave such that signal looks sinusidal with 24 discrete values and I dont know how to that, kindly help me out.
댓글 수: 0
답변 (1개)
Philippe Lebel
2019년 11월 26일
here is my try:
random_phase_offset = rand(1,1)*2*pi;
max_amplitude = 20;
random_amplitude = rand(1,1)*max_amplitude;
t = (0:1/23:1)*2*pi;
signal = random_amplitude * sin(t+random_phase_offset);
plot(t,signal)
댓글 수: 5
Philippe Lebel
2019년 11월 27일
편집: Philippe Lebel
2019년 11월 27일
by "start" what do you mean?
t is a list that goes from 0 to 4*pi in steps of 4*pi/23. It is written to have exactly 24 components.
Signal wouldn't have 24 values if "t" didn't have 24 values.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!