Not Enough Input Arguments
조회 수: 1 (최근 30일)
이전 댓글 표시
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));
댓글 수: 0
답변 (1개)
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.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!