필터 지우기
필터 지우기

generating time vector for noisy sine wave

조회 수: 5 (최근 30일)
Sahdev Patel
Sahdev Patel 2020년 9월 10일
편집: Xavier 2020년 9월 10일
I want to generate a vector signal with 4 cycles of 1kHz sinewave at a sampling frequency of 44.1kHz and an amplitude of 1V .Plot the signal on the screen and label the X and Y axes with the correct labels. can you plese correct the " t ". thank you.
fs= 44.1e3; % given sampling frequency
ts=1e3; % time period of each cycle
t=0:ts/fs:ts/4; % total time to wave
A= 1; % amplitude
x=A*sin(2*pi*t); % Generation of sine wave
plot (t,x) % Plotting of sine wave
xlabel ('Time period');
ylabel ('Amplitude')

답변 (1개)

Xavier
Xavier 2020년 9월 10일
편집: Xavier 2020년 9월 10일
%%Sine wave:
Fc = 1e-3; % hertz
%%Time specifications:
Fs = 44.1e3; % samples per second
dt = 1/Fs; % seconds per sample
nWavelengths = 4;
StopTime = (1/Fc) * nWavelengths; % seconds
t = (0:dt:StopTime-dt)'; % seconds
x = sin(2*pi*Fc*t);
% Plot the signal versus time:
figure;
plot(t,x);
xlabel('time (us)');
title('Signal versus Time');
zoom xon;
Adapted from here

카테고리

Help CenterFile Exchange에서 Signal Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by