필터 지우기
필터 지우기

Plotting cycles of signal

조회 수: 1 (최근 30일)
Ben Hamill
Ben Hamill 2019년 11월 15일
답변: Raunak Gupta 2019년 11월 18일
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 ≤ π

답변 (1개)

Raunak Gupta
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]);

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by