フィルターのクリア

How to represent waveform (sum of sinusoids) in complex notation

38 ビュー (過去 30 日間)
Nathan Kennedy
Nathan Kennedy 2018 年 1 月 9 日
コメント済み: Jan 2018 年 1 月 9 日
Hi,
I have a sum sinusoids to make a waveform, each sinusoid has a different phase attached to it.
clear
f = (20.2 : 0.01 : 21.2)*10^9;
Fs = 5*max(f);
Ts = 1/Fs;
end_t = 0.2*10^(-6);
dt = 0 : Ts : end_t-Ts;
for a = 1:length(f)-1
random_phase = 2*pi*rand(1,1);
%y(a,:) = 2 * sin(2*pi .* f(a) .* dt + random_phase);
end
waveform = sum(abs(y))
plot(dt,waveform)
I need to amplify this waveform, but the amplification being applied is in the form of a vector, it has an increase amplitude (gain) component and also a phase change component.
So the waveform is amplified but also subjected to phase change at instances in time.
To do this, my original waveform must be complex so I can multiply two complex numbers together to get the amplified waveform.
How do I do get my original code in a complex form?

採用された回答

Jan
Jan 2018 年 1 月 9 日
編集済み: Jan 2018 年 1 月 9 日
What about:
y(f,:) = cos(2*pi .* f .* dt + random_phase) + ...
1i * sin(2*pi .* f .* dt + random_phase);
Or equivalently:
y(f,:) = exp(1i * (2*pi .* f .* dt + random_phase));
  2 件のコメント
Nathan Kennedy
Nathan Kennedy 2018 年 1 月 9 日
編集済み: Nathan Kennedy 2018 年 1 月 9 日
I had to edit my original post because I pasted in test code that wasn't working. My original post now has working code.
I tried your idea and it works, but why is the imaginary component (sin) exactly the same as the real part (cos) in your code. Can this be trimmed down?
Jan
Jan 2018 年 1 月 9 日
Trimmed down to what? A complex sin wave can be expressed as
y = A * exp(k * t + a)
to define amplitude, frequency and phase shift. Together with the Euler formula: exp(ix) = cos(x) + i * sin(x) you get the shown code.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeContinuous Waveforms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by