필터 지우기
필터 지우기

Not Enough Input Arguments

조회 수: 3 (최근 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 CenterFile Exchange에서 Direction of Arrival Estimation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by