フィルターのクリア

Creating a linear array of pulses

1 回表示 (過去 30 日間)
Andy
Andy 2023 年 6 月 16 日
コメント済み: Mathieu NOE 2023 年 6 月 16 日
Hi,
I'm hoping someone may know the answer to this.
I'm trying to replicate a timing sequence from a past project.
I have generated the pulses from the following code and plotted the results.
sldb = input('Enter the required desirable restlessness in db: ')
dc = chebwin(16,sldb);
n=1:16;
plot(x,dc,'Db','linewidth',5);
What I would like to do is arrange the data to look like the following (if possible).
Thanks in advance.
Andy
  2 件のコメント
Andy
Andy 2023 年 6 月 16 日
Thanks Mathieu, that looks pretty much like the above diagram.
Mathieu NOE
Mathieu NOE 2023 年 6 月 16 日
my pleasure !

サインインしてコメントする。

採用された回答

Mathieu NOE
Mathieu NOE 2023 年 6 月 16 日
maybe this ?
I am not sure how you compute the "normalized on time " values so I tried something on my own :
h = dc(k)/sum(dc);
you can correct this with the right formula
n=16;
x = 1:n;
sldb = 30;
dc = chebwin(n,sldb);
figure(1)
plot(x,dc,'Db','linewidth',5);
figure(2)
for k = 1:n
h = dc(k)/sum(dc);
rectangle('Position',[k-0.5,(k-1)/n,1,h],'FaceColor',[0.58 0.82 0.98],'EdgeColor','b','LineWidth',2); % pos = [x y w h];
end
xlim([0.5 n+0.5]);
  1 件のコメント
Mathieu NOE
Mathieu NOE 2023 年 6 月 16 日
minor correction if you don't want the rectangles to touch each others
n=16;
x = 1:n;
sldb = 30;
dc = chebwin(n,sldb);
figure(1)
plot(x,dc,'Db','linewidth',5);
figure(2)
w = 0.75;
for k = 1:n
h = dc(k)/sum(dc);
rectangle('Position',[k-w/2,(k-1)/n,0.75,h],'FaceColor',[0.58 0.82 0.98],'EdgeColor','b','LineWidth',2); % pos = [x y w h];
end
xlim([0.5 n+0.5]);

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by