simulink error: data inferred as variable matrix but it's size is specified as inherited or fixed.
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
benja
am 4 Mär. 2023
Bearbeitet: benja
am 8 Mär. 2023
Hi,
My problem is as follows.
function coeff = DPD_Coeff_mine(PA_in,PA_out,memDepth,deg,DesiredGaindB)
J=(deg-1*memDepth);
xlen =length(PA_out);
y=complex(zeros(xlen));
y = y+PA_out/(10^(DesiredGaindB/10));
Y=complex(zeros(xlen,J)); %this is a NxJ matrix
for memidx=1:memDepth
ydelay=complex(zeros(1,xlen));
ydelay(1:xlen-memidx+1)=y(memidx:xlen); %xdelay = x[n-1],x[n-2],....
for powidx=1:deg-1
finidx=((memidx-1)*(deg-1))+powidx;
xrow=ydelay.*(abs(ydelay).^(powidx-1));%xrow=x[n-1]*|x[n-1]|,....
xcol=xrow'; %transpose row vexctor
Y(:,finidx)=xcol; %this is a copy of the function in predistort except we get the Y matrix now;
end
end
coefftemp = complex(zeros(1,J));
coefftemp= coefftemp+reshape(Y'*Y\Y'*PA_in',[1,J]); %cholesky decomposition to getcoefficient
coeff=coefftemp;
end
Above is the code I implemented into a function with the output the coeff array. I am fairly certain that it's not of variable size. The inputs PA_in and PA_out are signals and together with memDepth, deg and DesiredGaindB, they form the matrix Y as the code implies. Y should be a NxJ matrix thus from the code, coeff will always for any given simulation be a 1xJ matrix. The last 3 lines of code are my attempts at evading the error but they could be simplified with
coeff = reshape(Y'*Y\Y'*PA_in',[1,J]);
There have been multiple answers regarding going to the function block -> edit data and setting parameters to be non-tunable but on Matlab 2021b that I'm running, I can't see such an option. In any case, all help would be appreciated.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 4 Mär. 2023
Your coeff output has a size that depends on the data in deg and memDepth. Except possibly for the case where those inputs are fed by Constant blocks, that would appear as variable size to the code. However the output signal is not configured as variable size.
3 Kommentare
Walter Roberson
am 4 Mär. 2023
Sorry, I do not have enough experience to be able to say either way about that.
There might maybe be a way to use Parameters for the values and to configure the signal size according to a calculation of parameters.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu General Applications finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!