⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 my_scatterplot.m

📁 FPGA输出数据的时频域分析GUI界面
💻 M
字号:
function y=my_scatterplot(x,n,offset)
%SCATTERPLOT Generate a scatter plot.
%
%   SCATTERPLOT(X) generates a scatter plot of X.  X can be a real or complex
%   vector, or a two-column matrix with real signal in the first column and
%   imaginary signal in the second column.
%
%   SCATTERPLOT(X, N) generates a scatter plot of X with decimation factor N.
%   Every Nth point in X is plotted, starting with the first value.  The default
%   for N is 1.
%
%   SCATTERPLOT(X, N, OFFSET) generates a scatter plot of X with an offset.
%   OFFSET is the number of samples skipped at the beginning of X before
%   plotting.  The default value for OFFSET is zero.
%
%   SCATTERPLOT(X, N, OFFSET, PLOTSTRING) generates a scatter plot of X in the
%   line types, plot symbols and colors described by PLOTSTRING.  PLOTSTRING
%   can be any of the strings used in the PLOT function.  The default value for
%   PLOTSTRING is 'b.'.
%
%   Author: Crystal Shi
%   ShenZhen HYT CO.,LTD.
%   Copyright, 2007.8.23

error(nargchk(1,5,nargin));
error(nargoutchk(0,1,nargout));

if nargin<2 || isempty(n)
    n = 1;
end;
if nargin<3 || isempty(offset)
    offset = 0;
end;

[r, c] = size(x);
if r * c == 0
    error('Input variable X is empty.')
end;
if r == 1
    x = x(:);
end;

isRealX = isreal(x);
if ~isRealX
    x = [real(x), imag(x)];
end;

% don't allow N to be noninteger or less than or equal zero
if ((fix(n) ~= n) || (n <= 0))
    error('N must be a positive integer.')
end

% don't allow offset to be noninteger or less than zero
if ((fix(offset) ~= offset) || (offset < 0))
    error('OFFSET must be a nonnegative integer.')
end

% increment offset to create index into x
offset = offset + 1;

y = x(offset : n : size(x, 1), :);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -