I have a matrix with rows of 4 integers with an undetermined number of columns (depends on the text file).
I want to apply a function to each row of the matrix independently. The function has 4 inputs and 2 outputs.
I try to use the arrayfun function for this, but whenever I call the function, I get an error: "There are not enough input arguments."
Here is the function call:
[gain,phase]=arrayfun(@(x) GainPhaseComp(B(x,1:4)), 1:size(B));
where b is the matrix n by 4.
Here is the function:
function [gain,phase] = GainPhaseComp(InAmp,InPhase,OutAmp,OutPhase)
gain = 20*log10(OutAmp\InAmp);
phase = (OutPhase - InPhase);
end
Any help would be greatly appreciated!
source
share