フィルターのクリア

Dimension Disagree issue ?

1 回表示 (過去 30 日間)
shawin
shawin 2022 年 3 月 31 日
コメント済み: shawin 2022 年 4 月 4 日
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.

採用された回答

Chunru
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 )
nTotal = 60×1
1.5271 1.6793 1.5102 1.7007 1.6301 1.6533 1.1795 1.5919 2.6963 1.5790
RandomAssociationValues = ( n./nTotal );
  2 件のコメント
shawin
shawin 2022 年 3 月 31 日
編集済み: shawin 2022 年 3 月 31 日
No, the error is with :
RandomAssociationValues = ( n./nTotal );???
Error using ./
Matrix dimensions must agree.
Matlab version is : 2016a
shawin
shawin 2022 年 4 月 4 日
The code is working with Matlab 2022

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by