フィルターのクリア

How to plot quantized signal in MATLAB?

13 ビュー (過去 30 日間)
ABTJ
ABTJ 2021 年 2 月 26 日
回答済み: Mathieu NOE 2021 年 3 月 2 日
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?

回答 (1 件)

Mathieu NOE
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

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

製品


リリース

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by