フィルターのクリア

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 日間)
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;
x1=rectpuls(t1,rand);
x2=rectpuls(t2,rand);
figure
plot(t1,x1,t2,x2)
grid

採用された回答

Askic V
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 件)

カテゴリ

Help Center および File ExchangeSmoothing and Denoising についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by