フィルターのクリア

Generate single cycle of a sine wave at a particular frequency

573 ビュー (過去 30 日間)
Swetha
Swetha 2016 年 10 月 27 日
回答済み: HARSH VARDHAN 2024 年 1 月 22 日
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 件のコメント
KEERTHANA VELUSAMY
KEERTHANA VELUSAMY 2020 年 5 月 1 日
Could any one share matlab code for storing the signals data in 2 arrays of 64 elements
Gaurav Wadhai
Gaurav Wadhai 2021 年 12 月 5 日
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');

サインインしてコメントする。

回答 (9 件)

KSSV
KSSV 2016 年 10 月 27 日
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) ;
  2 件のコメント
Swetha
Swetha 2016 年 10 月 27 日
This is great! Thank you.
KSSV
KSSV 2016 年 10 月 27 日
Thanking is accepting the answer...

サインインしてコメントする。


anasuya b
anasuya b 2018 年 1 月 11 日
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 2018 年 6 月 7 日
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 2020 年 7 月 21 日
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 2020 年 7 月 21 日
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 2020 年 7 月 21 日
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 2020 年 7 月 21 日
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 2021 年 7 月 6 日
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 2024 年 1 月 22 日
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)

カテゴリ

Help Center および File ExchangeSwitches and Breakers についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by