moonnightingale
Full Member level 6

Hi i want to geenrate a sinusoid of .5 Khz with sampling frequency of 6 Khz
kindly help me to plot it
---------- Post added at 13:13 ---------- Previous post was at 12:42 ----------
ok i have written this code can anybody verify it
amp = 2; % Define the amplitude
freq_HZ = 500; % Define the frequency in Hertz
freq_RPS = 2*pi*freq_HZ; % Compute the frequency in rad/sec
t = 0:0.000166:1; % Define the sampling frequency
y = amp * sin(freq_RPS * t); % Compute y(t), the sine wave
plot(t,y) % Plot y vs. t
xlabel('Time (seconds)') % Label x-axis
ylabel('amplitude') % Label y-axis
title('Sinusoid of .5 Khz with fs=6Khz') % Give plot a title
grid % Turn on plot grid
figure
%plotting original signal with stem
stem(t,y)
kindly help me to plot it
---------- Post added at 13:13 ---------- Previous post was at 12:42 ----------
ok i have written this code can anybody verify it
amp = 2; % Define the amplitude
freq_HZ = 500; % Define the frequency in Hertz
freq_RPS = 2*pi*freq_HZ; % Compute the frequency in rad/sec
t = 0:0.000166:1; % Define the sampling frequency
y = amp * sin(freq_RPS * t); % Compute y(t), the sine wave
plot(t,y) % Plot y vs. t
xlabel('Time (seconds)') % Label x-axis
ylabel('amplitude') % Label y-axis
title('Sinusoid of .5 Khz with fs=6Khz') % Give plot a title
grid % Turn on plot grid
figure
%plotting original signal with stem
stem(t,y)