How to create sinusoidal signal of different frequencies for different time

14 visualizaciones (últimos 30 días)
I want to create a sinusoidal signal of different frequencies for different interval of time like 10hz for (0 pi/2),20Hz for (pi/2,pi),30Hz (pi,3*pi/2).Now i want to do fourier transform of this produced sinusoidal signal of different frequencies for different time.How can i do so??

Respuestas (1)

Sufiyan
Sufiyan el 2 de Mzo. de 2023
Hello,
You can refer to the below code to create a sinusoidal signal of different frequencies for different time interval.
% Define the time intervals and frequencies
t1 = linspace(0, pi/2, 1000); % frequency 10 Hz
t2 = linspace(pi/2, pi, 1000); % frequency 20 Hz
t3 = linspace(pi, 3*pi/2, 1000); % frequency 30 Hz
f1 = 10;
f2 = 20;
f3 = 30;
% Create sinusoidal signals for each interval
y1 = sin(2*pi*f1*t1);
y2 = sin(2*pi*f2*t2);
y3 = sin(2*pi*f3*t3);
% Concatenate signals and time intervals
t = [t1 t2 t3];
y = [y1 y2 y3];
% Plot signal
plot(t, y)
xlabel('Time')
ylabel('Amplitude')
title('Sinusoidal Signal with Different Frequencies')

Community Treasure Hunt

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

Start Hunting!

Translated by