PLOTTING TWO CYCLES SINE WAVE

조회 수: 29 (최근 30일)
Steven Bedoya
Steven Bedoya 2020년 11월 4일
댓글: Muhammad Adnan Liaquat 2021년 3월 5일
Hi,
I need some help for a project. I need to plot TWO cycles, frequency of 1khz sine wave with an amplitude of 5v. I'm using time as [0:2] but im not sure that's correct.
please help.

채택된 답변

Mohamad
Mohamad 2020년 11월 4일
f0=1000 ; % sinusoid frequency in Hz
fs=50*f0; % sampling frequency
dt=1/fs; % sampling interval
duration=0.01 ; % duration = 0.01 seconds , which means this duration has 10 cycles
t=0:dt:duration-dt ; % time vector
sig=5*sin(2*pi*f0*t); % sinusoidal signal duration 0.01 seconds
plot(t(1:fs*2/f0),sig((1:fs*2/f0))) ; % plot of 2 cycles of the sinusoidal signal
grid
  댓글 수: 3
Mohamad
Mohamad 2020년 11월 5일
Ok , please Accept the answer .
Muhammad Adnan Liaquat
Muhammad Adnan Liaquat 2021년 1월 27일
𝑦 = 2 𝑠𝑖𝑛( 𝜔𝑡) for 𝑓 = 40 (two cycles only) I want to drwa this please help me

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Mohamad
Mohamad 2021년 2월 10일
Hi , sorry for being late as I jsut saw the reply , run the code , accept the answer , thanks
%% generate and plot 2 sin(wt)
%% f= 40 Hz
f =40 ; % Sinusoid freuqncy
T=1/f; % Cycle durtation
fs=50*f; % Sampling frequency
dt=1/fs; % Sampling interval
t=0:dt:2*T-dt; % Time vector for 2 cycles
signal=2*sin(2*pi*f*t); % The required signal
plot(t,signal,'LineWidth',2) ; grid ; xlabel(' Time in Seconds ' ) ; ylabel ('Amplitude ' )
ylim([ -2.2 2.2])
  댓글 수: 1
Muhammad Adnan Liaquat
Muhammad Adnan Liaquat 2021년 3월 5일
Thanks brother but it's too late....

댓글을 달려면 로그인하십시오.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by