1
\$\begingroup\$

I have an assignment about Signals and Systems. I am completely new to MATLAB so i need extreme help on the assignment below:

Generate a noisy signal with sinusoidal components defined at 100 Hz and 300 Hz (3rd Harmonic)

a) Calculate (slow) its time and spectral variation
b) Calculate frequency resolution (deltaf)
c) Design a low pass filter to remove the 3rd harmonic and check its performance.

I need the code and the graphs to do this assignment. Any help is appreciated. Thank you.

\$\endgroup\$
2
  • 3
    \$\begingroup\$ What have you done so far? \$\endgroup\$
    – Renan
    Commented Aug 4, 2012 at 23:01
  • \$\begingroup\$ Voting to close as off-topic as this question is under the scope of dsp.stackexchange.com however, you need to show some effort. Just asking for code and graphics is not acceptable on any stackexchange sites. \$\endgroup\$
    – Kellenjb
    Commented Aug 6, 2012 at 0:56

1 Answer 1

4
\$\begingroup\$

It seems you don't know how to even start. I'll try to guide you a bit.

Matlab will be really useful to you. First, you need to understand the basics. You can find lots of tutorials, for example, this one: http://users.ece.gatech.edu/bonnie/book/TUTORIAL/tutorial.html

Then, once you know how to work with the software, you need to create a script that does the following.

  • Generate the two sinusoidal components (x1 and x2) and add them into x=x1+x2.
  • Generate the noise in a matrix n of the same length. I assume you are usign White Gaussian Noise, so you can check out this function: http://www.mathworks.es/help/toolbox/comm/ref/wgn.html
  • Get the noisy signal xn.
  • Compute Xnf and Xf as the spectrums for xn and x. I have always used the following base code, inserting proper values in the "...". Remember Nyquist Sampling Theorem!
Fs = ...; inct = 1/Fs; %Sampling frequency
T = ...; % T*Fs samples
N = Fs*T; % = T/inct;
t = [0:1/Fs:T-1/Fs]; % Time samples for T seconds [0,T)
f = [-Fs/2:Fs/N:Fs/2 – Fs/N]; % Frequency [-Fs/2,Fs/2)

Xf=fftshift(inct*fft(x)) %check fft and fftshift help, as well as FT theory.
  • Now you can design the filter in the frequency domain. I assume you can go for an ideal filter. You can call it Hf. Now, because of convolution FT property, Y(w)=H(w)X(w). No need for convolution!

  • Now check the performance. I don't know what "performance" refers to, but I think it has something to do with signal and noise power. If so, keep in mind that you don't need to compute an integral. MATLAB handles discrete signals so you can use the sum function instead.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.