How to plot quantized signal in MATLAB?
26 ビュー (過去 30 日間)
古いコメントを表示
During the process of analog to digital conversion Some time it is needed to plot quantized signal
Which command(s) can be used for plotting a quantized signal?
0 件のコメント
回答 (1 件)
Mathieu NOE
2021 年 3 月 2 日
hello
this little code snipset to illustrate what is sampling
quantization is simply to round the y values to the nearest 2^(n-1) value, (n = nb of bits of the ADC)
%Time Base
Fs = 1000;
dt = 1/Fs;
t = 0:dt:1.8;
samples = length(t);
%Sine Frequencies
Fn1 = 1;
Fn2 = 6;
signal = sin(2*pi*Fn1*t) + 0.25*sin(2*pi*Fn2*t);
% decimated signal for tem plot
decim = 50; % decimation factor
ind = (1:decim:samples);
t2 = t(ind);
x2 = signal(ind);
%Second Part
h = stem(t2, x2, 'linewidth', 2);
hold
plot(t, signal, 'linewidth', 2)
lgd = legend('Discrete Data', 'Continuous Data');
set (lgd, "fontsize", 12)
set(gca,'XTick',[0:0.2:1.8]);
set(gca,'YTick',[-2:0.5:2]);
title('Time vs Magnitude','fontweight','bold','fontsize',16);
xlabel('Time(s)','fontweight','bold','fontsize',14)
ylabel('Magnitude','fontweight','bold','fontsize',14)
grid
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!