# MATLAB

Discussion in 'Homework Help' started by greenjames287, Nov 6, 2015.

1. ### greenjames287 Thread Starter New Member

Sep 30, 2015
11
0
I am having trouble with this task in MATLAB and cant seem to get my graphs right. The following is what I need to do.

1. Generate a signal with frequencies 100Hz, 200Hz and 350Hz, using sample freq of 1kHz generate 1s of data.
2. Plot the signal and its Discrete Fourier Transform
3. Find the frequency response of an LTI system that filters out the higher and lower frequencies using Fourier Transform.
4. Produce magnitude and phase plot of frequency response
5. Plot impulse response of the system

I believe I have done 1-3 correctly but I don't think the graphs for 4 and 5 are correct. Any advice on where I am going wrong would be great, I have only been doing MATLAB for a few weeks.

Last edited: Dec 6, 2015

Sep 30, 2015
11
0

Feb 19, 2010
3,519
515

Sep 30, 2015
11
0
5. ### shteii01 AAC Fanatic!

Feb 19, 2010
3,519
515
Your signal got three frequencies in it, so your frequency plot should have 3 spikes. Since you don't say what the problem is... nobody see any point trying to figure it out and I don't have MatLab loaded on this pc so I can not run your code even if I wanted to.

6. ### greenjames287 Thread Starter New Member

Sep 30, 2015
11
0
I have 3 spikes on the frequency plot of the input but my problem is I am not sure if H is calculated correctly and if the phase and magnitude plots of it are correct. If I calculate the impulse response , h=ifft(H), and plot the convolution of that with the input I believe I should be getting just the middle frequency, which I am not. Graphs are attached.

File size:
9.7 KB
Views:
3
File size:
7.9 KB
Views:
3
File size:
10.8 KB
Views:
2
File size:
42.2 KB
Views:
2
7. ### shteii01 AAC Fanatic!

Feb 19, 2010
3,519
515
You are right, your magnitude plot got three spikes, it should have just one. In number 3 they are asking you to make and apply bandpass filter, where the filter blocks the 100 Hz and 350 Hz frequencies. It looks like you should work on that part, get the frequency plot that has that one spike at 200 Hz. Then do the magnitude and phase.

8. ### greenjames287 Thread Starter New Member

Sep 30, 2015
11
0
Should the magnitude plot have two or one spike? I fixed an error in that example I wrote so the plot of what should be the output has 1 spike at 200Hz. Calculating H and plotting magnitude and phase gives these graphs.

File size:
10.6 KB
Views:
2
File size:
8.8 KB
Views:
2

Feb 19, 2010
3,519
515
10. ### greenjames287 Thread Starter New Member

Sep 30, 2015
11
0
Last edited: Nov 7, 2015