How to Generate 5 Sine-waves each at 72° apart but every wave starting at 0.

2 次查看(过去 30 天)
How to generate a waveform as shown in figure?
  1 个评论
dpb
dpb 2020-5-3
Something else going on besides just a phase shift, though, in the figure.
There's some sort of transient in the first cycle that ramps up the amplitude with some overshoot of the steady-state magnitudes. W/O knowing what that was/is it's a shot in the dark.
A simple phase shift alone would be easy enough...

请先登录,再进行评论。

采纳的回答

Ameer Hamza
Ameer Hamza 2020-5-3
One of the easiest ways I can think of is to use a continuous-time filter, with initial conditions set to zero. The only caveat is the attenuation in the magnitude of the sine wave and a bit of shift in the absolute phase. The relative phase difference is still 72 degrees. The magnitude attenuation can be corrected by multiplying it with a factor as done in the following code.
This code requires the control system toolbox. The same can be done with ode45.
t = linspace(0, 3, 1000); % time vector
freq = 1; % 1 Hz
phases = 0:deg2rad(72):deg2rad(72)*5; % phase shifts, multiple of
y = sin(2*pi*freq*t + phases.'); % each row is a sine wave
% create and apply the filter
filter_freq = 3;
fil = tf(2*pi*filter_freq, [1 2*pi*filter_freq]); % create a filter
y_fil = zeros(size(y));
for i=1:size(y,1)
y_fil(i, :) = lsim(fil, y(i,:), t);
end
mul_factor = sqrt((2*pi*freq)^2+(2*pi*filter_freq)^2)/(2*pi*filter_freq); % filter attenuation factor
y_fil = mul_factor*y_fil;
plot(t, y_fil)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by