Error using normcdf function

11 vues (au cours des 30 derniers jours)
Oliver Lestrange
Oliver Lestrange le 22 Août 2020
Hi,
I am trying to make a CDF. I am using the array eixoXX.
% --- Executes on button press in densityButton.
function densityButton_Callback(hObject, eventdata, handles)
% hObject handle to densityButton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles = rmfield( handles, 'Antena' );
handles = rmfield( handles, 'nAntena' );
handles = rmfield( handles, 'Movel' );
handles = rmfield( handles, 'Rheight' );
handles = rmfield( handles, 'Rwidth' );
i = handles.map.img(:,:,1)==255 & handles.map.img(:,:,2)==255 & ...
handles.map.img(:,:,3)==255;
Prx = handles.maxPrxArray;%(i);
minPower = round(handles.minPrx);
maxPower = round(handles.maxPrx);
eixoXX = minPower:.1:maxPower;
size = length(Prx);
figure
plot(eixoXX, cdf('Normal',eixoXX, mean(Prx),std(Prx)))
grid on;
I always get the error:
Error using normcdf>localnormcdf (line 79)
Non-scalar arguments must match in size.
I don't know how de cdf function really works but it seems that is supposed to have a mu and sigma, that's why I have an mean and std.
Can someone explain me what I am doing wrong?
Thanks!

Réponse acceptée

Star Strider
Star Strider le 22 Août 2020
I am guessing that ‘Prx’ is a matrix, not a vector, and apparently ‘eixoXX’ is a vector. In that instance, the mean and std will be vectors. This is not compatible with the Input Arguments requirements of the cdf function.
See if calculating the mean and standard deviation as:
mean(Prx(:))
std(Prx(:))
will produce the result you want.

Plus de réponses (0)

Catégories

En savoir plus sur Structures dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by