Borrar filtros
Borrar filtros

Generate single cycle of a sine wave at a particular frequency

570 visualizaciones (últimos 30 días)
Swetha
Swetha el 27 de Oct. de 2016
Respondida: HARSH VARDHAN el 22 de En. de 2024
Hello, I need help generating a single cycle of a sinewave at a particular frequency and sampling rate. The following example generates multiple cycles and I am not sure how to get a single cycle.
fs = 512; % Sampling frequency (samples per second)
dt = 1/fs; % seconds per sample
StopTime = 0.25; % seconds
t = (0:dt:StopTime-dt)'; % seconds
F = 60; % Sine wave frequency (hertz)
data = sin(2*pi*F*t);
Thank you,
  4 comentarios
KEERTHANA VELUSAMY
KEERTHANA VELUSAMY el 1 de Mayo de 2020
Could any one share matlab code for storing the signals data in 2 arrays of 64 elements
Gaurav Wadhai
Gaurav Wadhai el 5 de Dic. de 2021
clc;
clear all;
close all;
L = 3; %Up-sampling factor
M = 2; %Down-sampling factor
n = 0:29;
x = sin(2*pi*0.43*n) + sin(2*pi*0.31*n);
y = resample(x,L,M);
subplot(2,1,1),stem(n,x(1:30));
xlabel('Time index n');
ylabel('Amplitude');
title('lnput Sequence');
m = 0:(30*L/M)-1;
subplot(2,1,2),stem(m,y(1:30*L/M));
axis([0 (30*L/M)-1 -2.2 2.21]);
xlabel('Time index n');
ylabel('Amplitude');
title('Output Sequence');

Iniciar sesión para comentar.

Respuestas (9)

KSSV
KSSV el 27 de Oct. de 2016
fs = 512; % Sampling frequency (samples per second)
dt = 1/fs; % seconds per sample
StopTime = 0.25; % seconds
t = (0:dt:StopTime)'; % seconds
F = 60; % Sine wave frequency (hertz)
data = sin(2*pi*F*t);
plot(t,data)
%%For one cycle get time period
T = 1/F ;
% time step for one time period
tt = 0:dt:T+dt ;
d = sin(2*pi*F*tt) ;
plot(tt,d) ;

anasuya b
anasuya b el 11 de En. de 2018
I wante to make a sine wave . First donot know how to create vector how to create a vector for a sample data of 300 in 5 min time (300 sec) PL help

Fahad Hossen
Fahad Hossen el 7 de Jun. de 2018
fs = 512; % Sampling frequency (samples per second) dt = 1/fs; % seconds per sample StopTime = 0.25; % seconds t = (0:dt:StopTime)'; % seconds F = 60; % Sine wave frequency (hertz) data = sin(2*pi*F*t); plot(t,data) %% For one cycle get time period T = 1/F ; % time step for one time period tt = 0:dt:T+dt ; d = sin(2*pi*F*tt) ; plot(tt,d) ;

Qammar Taskeen
Qammar Taskeen el 21 de Jul. de 2020
Generate the following signals in MATLAB using subplot command such that the x-axis title contains your UET (2 Fig Roll No.) and y-axis title contains your APCOMS (4 Fig Roll No) while the title of the plot shows your Name and Batch No. (CLO-01, PLO-5) (25 Marks)
  • Sinusoid
  • Kronecker Delta
  • Unit step signal
  • Ramp
Complex Exponential

Qammar Taskeen
Qammar Taskeen el 21 de Jul. de 2020
Demonstrate the designing of a circuit in MATLAB Simulink such that it represents the equation sin2 φ + cos2 φ = 1 where φ = UET (2 Fig Roll No.) the output should have an amplitude of 1 on the “scope”. Save the .mdl file and attach it in the online submission of this assignment. Also add its screenshot in the assignment.

Qammar Taskeen
Qammar Taskeen el 21 de Jul. de 2020
Demonstrate the generation of a Saw Tooth wave from its Fourier Series in MATLAB such that the x-axis title contains your UET (2 Fig Roll No.) and y-axis title contains your APCOMS (4 Fig Roll No) while the title of the plot shows your Name and Batch No.

Qammar Taskeen
Qammar Taskeen el 21 de Jul. de 2020
Find and Demonstrate the inverse Z-Transform of following. Here a and b are the two digits of your UET (2 Fig Roll No.) whereas c, d, e and f represent the 4-digits of your APCOMS (4 Fig Roll No).

Sanjay Talbar
Sanjay Talbar el 6 de Jul. de 2021
fs = 512; % Sampling frequency (samples per second)
dt = 1/fs; % seconds per sample
StopTime = 0.25; % seconds
t = (0:dt:StopTime-dt)'; % seconds
F = 60; % Sine wave frequency (hertz)
data = sin(2*pi*F*t);

HARSH VARDHAN
HARSH VARDHAN el 22 de En. de 2024
Q1. Write A Matlab code
a) To Generate the following frequency signals and play as audio tones for each one second duration.
Sa
Re
Ga
Ma
Pa
Da
Ni
Sa
240Hz
270Hz
300Hz
320
360Hz
400Hz
450Hz
480Hz
b) To Create a variable to store the following tune and also play the audio tone for following sequences : Sa Re Sa Re| Sa Re Ga Ma| Sa Ni Sa NI |Sa Ni Da Pa
c) Also show the amplification and attenuation of the above generated tone
Q2. Write a Matlab code
a) to read the given input signal data from Microsoft Excel sheet and store the same.
b) to display the graph of above stored date.
c) to perform the following signal operations on the input signal
i. x(2t-1)
ii. 2*x(4+t)
iii. x(2-0.5t)
iv. (2/3)*x(2+0.5t)

Community Treasure Hunt

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

Start Hunting!

Translated by