Digital Signal Processing, DSP
Show older comments
Who can help me ? I have a task.
1. Make a sinusoid. User gives amplitude and frequency (input command). 2. Sampling - two periods (Shannon-Kotelnikov theorem) 3. Quantization with 3-bit converter 4. 8 the least significant bit's - change to HEX and DEC
I tried all last week and nothing. This is all what I did:
clear all
close all
a = input(Amplitude: ');
f = input('Frequency: ');
fp = 100*f;
N = 2*100;
T1 = N/fp;
t1 = (0:N-1)/fp;
s1 = a*sin(2*pi*f*t1);
fp = 2*f
s2 = s1(1:N/fp:end);
t2 = (0:length(s2)-1)/fp;
plot(t1,s1)
hold
stem(t2,s2,'rx')
hold
xlabel('Time [s]')
ylabel('Amplitude')
Answers (0)
Categories
Find more on Get Started with DSP System Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!