# how do I plot the signal x(t)=t^2 for -2<=abs(t)<=2 and x(t)=0 for 2<=abs(t)<=4, with period To=8??

조회 수: 6 (최근 30일)
Dimitrios Kyriakidis 2023년 6월 8일
댓글: Dimitrios Kyriakidis 2023년 6월 8일
how do I plot the signal x(t)=t^2 for -2<=abs(t)<=2 and x(t)=0 for 2<=abs(t)<=4, with period To=8?? also i would like to know how to calculate the complex coefficients of the fourier series and the approximation

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

### 답변 (1개)

KALYAN ACHARJYA 2023년 6월 8일
First Way:
To meet your professor's expectations, you can code by incorporating conditional statements or utilizing the if-else function.
1. If else or Conditional Statements
2. Plot
Other way:
syms t
x_t=piecewise(-2<=abs(t) | abs(t)<=2,t.^2,2<=abs(t) | abs(t)<=4,0);
t_data=-8:0.01:8;
x_data=subs(x_t,t,t_data);
plot(t_data,x_data)
##### 댓글 수: 1이전 댓글 -1개 표시이전 댓글 -1개 숨기기
Dimitrios Kyriakidis 2023년 6월 8일
Unfortunately, I have the r2016a version which hasn't the piecewise finction. Although the same result made with "if-else" statements would be acceptable

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

### 카테고리

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