Matlab Code Help for x[n]=x(n2Ts)

Click For Summary

Discussion Overview

The discussion revolves around a homework problem involving the plotting of a discrete-time signal derived from a continuous-time signal using MATLAB. Participants are focused on the correct implementation of downsampling and plotting techniques in MATLAB.

Discussion Character

  • Homework-related

Main Points Raised

  • One participant presents a continuous-time signal defined as x(t)=4sin(0.5t).2u(t) and seeks assistance with the discrete-time representation x[n]=x(n2Ts).
  • Another participant suggests that downsampling x(t) by a factor of 2 is the solution and indicates that with Ts=0.25, the participant should leave a sample between every two samples to obtain x[n].
  • A subsequent participant questions whether a specific code snippet provided would correctly plot the downsampled signal, indicating uncertainty about the implementation.
  • One participant expresses frustration over the lack of additional help from others in the thread.

Areas of Agreement / Disagreement

There is no consensus on the exact code implementation for plotting x[n], and uncertainty remains regarding the correct approach to downsampling and plotting the discrete-time signal.

Contextual Notes

Participants have not fully clarified the definitions or assumptions related to the downsampling process, and the mathematical steps for the transformation from x(t) to x[n] are not resolved.

lcw1972
Messages
3
Reaction score
0

Homework Statement


x(t)=4sin(0.5t).3u(t)
x[n]=x(n2Ts)

The 1st equation, x(t)=4sin(0.5t).2u(t)
Code :
>> A=2;
>> wo=0.5;
>> t=5:0.25:50;
>> x=A*sin(wo*t).3*(t>=0);
>> plot(t,x), grid on
>> xlabel('t (s)'); ylabel('Amplitude(unit)')

But the second one,x[n]=x(n2Ts), I don't know what code should I use to plot it out,pls help,thanks.
 
Last edited:
Physics news on Phys.org
Hi,
The second part is just down sampling the x(t) by 2. You have already chosen Ts=0.25. So just leave a sample between every two samples and you will get x[n]
 
Hi,
U mean I just use below code to plot it out?
>> T=0.25;
>> x=2*T*(A*sin(wo*n).3*(n>=0));
 
Last edited:
No one else can help?
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
Replies
2
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
5K