How to create sinusoidal signal of different frequencies for different time
21 次查看(过去 30 天)
显示 更早的评论
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??
0 个评论
回答(1 个)
Sufiyan
2023-3-2
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')
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!