Plotting cycles of signal
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi, I am relatively unexperienced with MATLAB but how do i plot any number of cycles of the following signal;
z(t) = 0 if − π ≤ t < 0
3 if 0 ≤ t ≤ π
댓글 수: 0
답변 (1개)
Raunak Gupta
2019년 11월 18일
Hi,
For plotting the function mentioned in the question you may use square wave as it will replicate your requirements. I have written an example below which plots the function in range [-16π,16π]. You may find it helpful.
% This particular t will plot 16 cycles
% t can be changed accordingly for plotting particular number of cycles
t = -16*pi:0.02:16*pi;
x = 3*square(t); % Period of the wave is 2*pi
x = x.*(x>=0); % converting negative cycle to zero as per function requirement
plot(t/pi,x); % Plotting t/pi for better understanding
xticks(-16:16);
xlabel('t / \pi')
ylim([-1,4]);
xlim([-17,17]);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!