I have to create a rectangular signal with a different period and amplitude at every run, but I don t know how to chnage the aplitude
2 ビュー (過去 30 日間)
古いコメントを表示
採用された回答
Askic V
2022 年 12 月 9 日
編集済み: Askic V
2022 年 12 月 9 日
Just play with randn (normal/gauss distrbution):
clc
close all
clear all
format long
Fs1=1000;
Fs2=1000;
Ts1=1/Fs1;
Ts2=1/Fs2;
A1=1;
A2=2;
t1 =-2 : Ts1 : 2;
t2=-2 : Ts2 :2;
width1 = 1+0.5*randn; % Signal width is 1 with std deviation +-0.5
width2 = 1+2*randn; % Signal width is 1 with std deviation +-0.5
amp1 = 3 + 2*randn; % amp1 is 3 with deviation of +-2
amp2 = 2 + 0.5*randn;
x1 = amp1*rectpuls(t1,width1);
x2 = amp2*rectpuls(t2,width2);
figure
plot(t1,x1,t2,x2)
grid
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!