필터 지우기
필터 지우기

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 CenterFile Exchange에서 Resizing 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