how to plot a continuous signal

조회 수: 225 (최근 30일)
Mohammadreza kalantari
Mohammadreza kalantari 2019년 10월 19일
댓글: Star Strider 2019년 10월 31일
I want to plot x(t) = cos(200*pi*t*u(t)) and define u(t) seprately and then plot x(-t),x(t/3)
i wrote this
x = @(t) cos(200*pi*t*u(t));
t = linspace(-1, 1);
figure(1)
plot(t, x(t))
grid
function y = u(x)
y=0;
if x>=0
y=1;
end
end

채택된 답변

Star Strider
Star Strider 2019년 10월 19일
This should get you started:
u = @(t) t>=0;
x = @(t,u) cos(200*pi*t.*u(t));
t = linspace(-1, 1);
figure(1)
plot(t, x(t,u))
grid
Extending that:
u = @(t) t>=0;
x = @(t,u) cos(200*pi*t.*u(t));
t = linspace(-1, 1);
figure(1)
plot(t, x(t,u))
hold on
plot(t, x(-t,u))
plot(t, x(t/3,u))
hold off
grid
Experiment to get different results.
  댓글 수: 8
Mohammadreza kalantari
Mohammadreza kalantari 2019년 10월 31일
편집: Mohammadreza kalantari 2019년 10월 31일
I asked in that way too.
Star Strider
Star Strider 2019년 10월 31일
I will delete this Comment in a few minutes, then.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by