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

AI Thread Summary
The discussion centers on creating MATLAB code to plot the discrete signal x[n] derived from the continuous signal x(t)=4sin(0.5t).3u(t). The user successfully plots the continuous signal but is unsure how to implement downsampling for x[n]=x(n2Ts). It is clarified that downsampling by a factor of 2 can be achieved by selecting every second sample, given Ts=0.25. The suggested code involves using T=0.25 and adjusting the sampling accordingly. The conversation emphasizes the importance of correctly implementing the downsampling process in MATLAB.
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?
 
Thread 'Have I solved this structural engineering equation correctly?'
Hi all, I have a structural engineering book from 1979. I am trying to follow it as best as I can. I have come to a formula that calculates the rotations in radians at the rigid joint that requires an iterative procedure. This equation comes in the form of: $$ x_i = \frac {Q_ih_i + Q_{i+1}h_{i+1}}{4K} + \frac {C}{K}x_{i-1} + \frac {C}{K}x_{i+1} $$ Where: ## Q ## is the horizontal storey shear ## h ## is the storey height ## K = (6G_i + C_i + C_{i+1}) ## ## G = \frac {I_g}{h} ## ## C...

Similar threads

Back
Top