Error using normcdf function

4 次查看(过去 30 天)
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!

采纳的回答

Star Strider
Star Strider 2020-8-22
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Structures 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by