![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1319090/image.png)
Generate trapezoidal waveform from a square waveform using convolution
조회 수: 25 (최근 30일)
이전 댓글 표시
Hello,
I try to generate a trapezoidal waveform from a square waveform using convolution using rectpuls() and fft() but I don't manage to obtain the good result with correct amplitude (i.e. same as the original signal). Could you please help me ?
Thank you !
Example:
t = 0:10e-6:10;
signal = 270*square(t);
trise=100e-6;
x = rectpuls(t-trise/2,trise);
conv = ifft(fft(signal).*fft(x));
figure
plot(t,signal,'k-+'); hold on
plot(t,conv,'r-s'); hold on
legend('signal', 'conv')
xlabel('Time (s)')
ylabel('Signal (-)')
댓글 수: 0
채택된 답변
William Rose
2023년 3월 9일
편집: William Rose
2023년 3월 9일
[edit correct capitalization errors]
Your convolution worked and it did produce a trapezoidal signal. You just need to zoom in more on the transitions to see the trapezoidal shape. See zoomed-in plot below.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1319090/image.png)
If you want wider transitions, then you need to make the signal x have a wider pulse. In its present form, the pulse in x is only 0.0001 time units long.
댓글 수: 4
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Waveform Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!