Sum of signals and filter the sum and recuperate the inicial frequencies

15 ビュー (過去 30 日間)
yusra Ch
yusra Ch 2020 年 3 月 12 日
編集済み: Jakob B. Nielsen 2020 年 3 月 13 日
Hello, I am new to matlab,
I would like to generate two diffrent sinus signal with diffrent frequencies f1 and f2. One generated I want to do the sum of them (let's call it totalSignal) . Next, I want t filter the total signal and recuperate f1 and f2.
Any body can help me?

採用された回答

Jakob B. Nielsen
Jakob B. Nielsen 2020 年 3 月 12 日
編集済み: Jakob B. Nielsen 2020 年 3 月 12 日
Making the simulated signal is quite simple. First, make a vector t which covers the time domain you are interested in. Then, generate your two sine vectors from this x, and add them together:
t=0.001:0.001:1; %this gives you t that starts from 0.001, in steps of 0.001, up to 1.
f1=10;
f2=100;
totalSignal=sin(2*pi*f1*t)+sin(2*pi*f2*t); %two signals with frequency 10 and 100 Hz, lets imagine.
plot(t,totalSignal);
Now that you have your signal, you can look into different options for recovering your original input frequencies. Fourier analysis is a great way of achievting this - check out the fft documentation for more info.
  5 件のコメント
yusra Ch
yusra Ch 2020 年 3 月 12 日
One more question, when I do:
plot(t,wave1)
hold on
plot(t,real(invers3))
the signal are not 100% similar, there is a slight diffrence, is it normal or not ? and why they are not 100% similar.
Jakob B. Nielsen
Jakob B. Nielsen 2020 年 3 月 13 日
編集済み: Jakob B. Nielsen 2020 年 3 月 13 日
It is probably a matter of "resolution". If you look at the frequency domain plot, you will see that the "peaks" at 30 and 60 Hz has some 'shoulder' like qualities, as well as at 70 Hz the power dips below 0 for a little bit. All of this is information; but since you only have 50 frequencies to spread this information out on, some of it will invariably be lost hwne you do a very 'crude' filtering.
Try, for example, to set your "sampling resolution" to 10000 instead of 1000, and repeat the entire thing; you will see your ifft comes much much closer to your original 30 Hz signal then. If you took a "resolution" of 100000 it would be even closer.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFilter Analysis についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by