So I am trying to plot basic signals in MATLAB for an assignment, and I am wondering how to do so. For example how would I plot a signal such as "plot x1(t)=u(t+1)-u(t-5) where -7 < t < 7seconds"

댓글 수: 2

Jaya
Jaya 2022년 3월 7일
Good that you admit it is an assignment question. That's why can you first please show whatever code you have tried to attempt? Then, it is ok for people to correct your code to guide you.
Isaiah Moore
Isaiah Moore 2022년 3월 8일
편집: Isaiah Moore 2022년 3월 8일
I have tried using heaveside and fplot from another person that asked a similar question, I used this.
syms t l
l(t) = heaviside(t+1) + heaviside(t-5)
fplot(l, [-7,7])
But I believe that I am doing the first part of the question, but not the "where -7 < t < 7seconds" part

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

답변 (1개)

Image Analyst
Image Analyst 2022년 3월 8일

0 개 추천

After your code, try limiting the x axis to -7 to 7
xlim([-7, 7]);
Or you can use a numerical example - not syms. Like
numElements = 1000;
t = linspace(-7, 7, numElements);
% Compute l(t) then plot % You can do this line yourself.
plot(t, l, 'LineWidth', 2);
xlabel('t')
ylabel('l(t)');
grid on;

카테고리

도움말 센터File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기

제품

릴리스

R2021b

태그

질문:

2022년 3월 7일

편집:

2022년 3월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by