Hi:
I'm working on a matlab project, and I do not have too much knowledge in Matlab. Here is my problem:
-------
1) The sampling rate assumed in hw2channel is 10Mhz. This means that the time elapsed between two adjacent samples in any signal vector is 100ns. You have to keep this in mind when generating signals in MATLAB to test the channgel.
Generate an impulse, a square wave of fundamental frequency 1MHz, and a pure sinusoid of frequency 2.5MHz.
Hint1: In MATLAB, an impulse can represented by an 1 followed by many 0s.
Hint2: For the square wave and sinusoid, since we cannot have infinite length signal vectors in MATLAB, we have to truncate the signals to finite length. As a result when putting these finite-length signals through the channel, transient s will occurs at the beginning and the end. Here we will care mostly about the stead state responses. Hence you will need to generate long enough signal vectors to allow the transients to die down before observing the steady state responses.
----
Here is my code. I do not know if I am initializing it correct, and I am not sure what my t has to be.
Code:
fsample = 10e6; %sample rate (Hz)
square_fs = 1e6; %frequency of square wave is 1MHz
sinusoid_fs = 2.5e6; %frequency of sinusoid is 2.5MHz
gen_impulse = [1,zeros(1,size(t))]; %generate impulse wave
gen_square = square(2*pi*square_fs*t); %generate square wave
gen_sin = sin(2*pi*2.5e6*t)
Can someone help?
Thanks