How to create sinusoidal signal of different frequencies for different time

조회 수: 16 (최근 30일)
MITHUN RANA
MITHUN RANA 2019년 2월 28일
답변: Sufiyan 2023년 3월 2일
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??

답변 (1개)

Sufiyan
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')

카테고리

Help CenterFile Exchange에서 Discrete Fourier and Cosine Transforms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by