How to create sinusoidal signal of different frequencies for different time
조회 수: 16 (최근 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!