How to Generate 5 Sine-waves each at 72° apart but every wave starting at 0.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hammad
am 3 Mai 2020
Beantwortet: Ameer Hamza
am 3 Mai 2020
How to generate a waveform as shown in figure?
1 Kommentar
dpb
am 3 Mai 2020
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...
Akzeptierte Antwort
Ameer Hamza
am 3 Mai 2020
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Filter Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!