Dimension Disagree issue ?
1 次查看(过去 30 天)
显示 更早的评论
Hi,
I have the code below :
% 2D Data
sample1 = [ ( 75.2 - 32 ).*rand( 1, 20 ) + 32, ...
( 60 - 20 ).*rand( 1,20 ) + 20, ...
( 15 -( -3.4 ) ).*rand( 1, 20 ) + ( -3.4 )
]';
sample2 = [ ( 19.2 - 1 ).*rand( 1,20 ) + 1, ...
( -10 - ( -42.5 ) ).*rand( 1,20 ) + ( -42.5 ), ...
( 20.4 - ( -5 ) ).*rand( 1,20 ) + ( -5 )
]';
inputs = [ sample1, sample2 ];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nClusters=3;
fuzzification=2;
[nInputs, nInputSamples ] = size( inputs );
% Number of Clusters
nC = nClusters;
% fuzzification parameter
m = fuzzification;
% Generate the random association of inputs to the clusters, values [ 0, 1 ]
n = rand( nInputs, nC );
nTotal = sum( n, 2 );
RandomAssociationValues = ( n./nTotal );
when i run it , i recieved an error which is :
kindly , how can i fix this issue???
Error using ./
Matrix dimensions must agree.
0 个评论
采纳的回答
Chunru
2022-3-31
Your code can run without issue as show below.
Try "clear all;" before running the code. Or you can step through your code to see where the code goes wrong.
% 2D Data
sample1 = [ ( 75.2 - 32 ).*rand( 1, 20 ) + 32, ...
( 60 - 20 ).*rand( 1,20 ) + 20, ...
( 15 -( -3.4 ) ).*rand( 1, 20 ) + ( -3.4 )
]';
sample2 = [ ( 19.2 - 1 ).*rand( 1,20 ) + 1, ...
( -10 - ( -42.5 ) ).*rand( 1,20 ) + ( -42.5 ), ...
( 20.4 - ( -5 ) ).*rand( 1,20 ) + ( -5 )
]';
inputs = [ sample1, sample2 ];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nClusters=3;
fuzzification=2;
[nInputs, nInputSamples ] = size( inputs );
% Number of Clusters
nC = nClusters;
% fuzzification parameter
m = fuzzification;
% Generate the random association of inputs to the clusters, values [ 0, 1 ]
n = rand( nInputs, nC );
nTotal = sum( n, 2 )
RandomAssociationValues = ( n./nTotal );
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!