フィルターのクリア

Not Enough Input Arguments

2 ビュー (過去 30 日間)
Dhananjay Singh
Dhananjay Singh 2019 年 3 月 7 日
回答済み: Jan 2019 年 3 月 7 日
Hi, I am new to Matlab and I am facing an error while generating a signal which i hae to use in other programs as well,
Here is the code which I am using to create signal,
if ~exist('coherence', 'var')
coherence = false;
rng('default')
end
if ~exist('nSamples', 'var')
nSamples = 1e3;
end
if ~exist('amplitudes', 'var')
amplitudes = zeros(1,numel(xPos));
end
if ~isvector(xPos)
error('X-positions of array elements must be a 1xP vector where P is number of elements')
end
if ~isvector(yPos)
error('Y-positions of array elements must be a 1xP vector where P is number of elements')
end
if ~isvector(zPos)
error('Z-positions of array elements must be a 1xP vector where P is number of elements')
end
T = nSamples/fs;
t = 0:1/fs:T-1/fs;
signalTotal = 0;
for k = 1:numel(thetaArrivalAngles)
%Create signal hitting the array
doa = squeeze(steeringVector(xPos, yPos, zPos, f, c, thetaArrivalAngles(k), phiArrivalAngles(k)));
%Add random phase to make signals incoherent
if coherence
signal = 10^(amplitudes(k)/20)*doa*exp(1j*2*pi*f*t);
else
signal = 10^(amplitudes(k)/20)*doa*exp(1j*2*pi*(f*t+randn(1, nSamples)));
end
%Total signal equals sum of individual signals
signalTotal = signalTotal + signal;
end
When i run this program, I get the error shown below. I have no idea how to resolve it. Please can someone help me with this
Not enough input arguments.
Error in createSignal (bold part in code)
amplitudes = zeros(1,numel(xPos));

回答 (1 件)

Jan
Jan 2019 年 3 月 7 日
The message means, that xPos is not defined. I guess, that you forgot to provide input arguments to your function. Maybe you have pressed teh "Run" button in the editor, but a function must be called with input arguments.

カテゴリ

Help Center および File ExchangeDirection of Arrival Estimation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by