how to display and store all the data that has been processed in the form of a matrix in neural network?

1 view (last 30 days)
I have a problem in my program below. there is an error in the matrix appearance. What should I do to keep all the data in a matrix form below so that the neural network can be processed?
??? Error using ==> minus
Matrix dimensions must agree.
Error in ==> prestd at 90
tn = (t-meant0*oneQ)./(stdt0*oneQ);
Error in ==> cobaaja at 71
[pn,meanp,stdp,tn,meant,stdt] = prestd(P,T);
my program:
clear all;
% You can customize and fix initial directory paths
DatabasePath = uigetdir('Pilih Database' );
prompt = {'Pilih image yang akan diproses ( 1 to 20):'};
dlg_title = 'cobacoba';
num_lines= 1;
def = {'1'};
cobacoba = inputdlg(prompt,dlg_title,num_lines,def);
cobacoba = strcat(DatabasePath,'\',char(cobacoba),'.jpg');
I = imread(cobacoba);
imshow (I);
%untuk mengubah gambar ke dalam bentuk nilai biner
red=I(:,:,1); %memanggil matriks gambar yang hanya berisi piksel warna merah
green= I(:,:,2);% memanggil matriks gambar yang hanya berisi piksel warna hijau
blue=I(:,:,3); %memanggil matriks gambar yang hanya berisi piksel warna biru
merahgray2=0.3*red+0.5*green+0.2*blue ;
%menampilkan nilai RGB
R = I(:,:,1);
G = I(:,:,2);
B = I(:,:,3);
%menampilkan sum dari RGB
sumR = sum(sum(R));
sumG = sum(sum(G));
sumB = sum(sum(B));
n= (sumR+sumG+sumB);
% Normalisasi warna pada citra
NormalizedRed = sumR * sqrt ( sumR^2+ sumG^2 + sumB^2);
NormalizedGreen = sumG * sqrt ( sumR^2+ sumG^2 + sumB^2);
NormalizedBlue = sumB * sqrt ( sumR^2+ sumG^2 + sumB^2);
% Mencari mean
MeanR = 1/n*sumR*1.0e+005
MeanG = 1/n*sumG*1.0e+005
MeanB = 1/n*sumB*1.0e+005
% Mencari standar deviasi
%Mencari kurtosis
kR=( 1/n*((sumR-MeanR)^4))/(1/n*((sumR-MeanR)^2))^2
kG=( 1/n*((sumG-MeanG)^4))/(1/n*((sumG-MeanG)^2))^2
kB=( 1/n*((sumB-MeanB)^4))/(1/n*((sumB-MeanB)^2))^2
% Mencari Skewness
SkR = ( 1/n*((sumR-MeanR)^3))/sqrt(1/n*((sumR-MeanR)^2))^3
SkG = ( 1/n*((sumG-MeanG)^3))/sqrt(1/n*((sumG-MeanG)^2))^3
SkB = ( 1/n*((sumB-MeanB)^3))/sqrt(1/n*((sumB-MeanB)^2))^3
% Data Input & Target
P=[MeanR MeanG MeanB sR sG sB kR kG kB SkR SkG SkB]
T=[-1 0 1]
% Preprocessing
[pn,meanp,stdp,tn,meant,stdt] = prestd(P,T);
% Membangun jaringan dengan propagasi umpan balik berbasis jaringan syaraf tiruan
net = newff(minmax(pn),[10 5 1],{'tansig' 'logsig' 'purelin'},'traingdm')
% melihat bobot awal jaringan
BobotAwal_Input = net.IW{1,1};
BobotAwal_Bias_Input = net.b{1,1};
BobotAwal_Lapisan1 = net.LW {2,1};
BobotAwal_Bias_Lapisan = net.b {2,1};
% Set parameter pelatihan
net.trainParam.epochs = 1000;
net.trainParam.goal = 1e-04; = 0.6;
net.trainParam.showCommandLine = true; = 100; = 0.7;
% pelatihan
net = train(net,pn,tn);pause
% melihat bobot akhir jaringan
BobotAkhir_Input = net.IW{1,1};
BobotAkhir_Bias_Input = net.b{1,1};
BobotAkhir_Lapisan1 = net.LW {2,1};
BobotAkhir_Bias_Lapisan = net.b {2,1};
%simulasi terhadap data pelatihan
an = sim(net,pn);
a = poststd (an,meant,stdt);
H = [(1:size(P,2))' T' a' (T'-a')];
sprintf('%2d %9.2f %7.2f %5.2f\n',H')
%Evaluasi output jaringan (data pelatihan dengan target)
[m1,a1,r1] = postreg (a,T);
plot (1:size(P,2),T,'bo',1:size(P,2),a','r*');
title('Hasil pengujian dengan data pelatihan Target (o), Output (*)');
xlabel('Data ke-');
In addition, please guide me, sincerely Yours Een Qurota Aini
Een Qurota Aini
Een Qurota Aini on 7 Oct 2013
Edited: Een Qurota Aini on 7 Oct 2013
P=[MeanR MeanG MeanB sR sG sB kR kG kB SkR SkG SkB];
T=[-1 0 1];
sR=Deviation Standart from RGB Value R
sG=Deviation Standart from RGB Value G
sB=Deviation Standart from RGB Value B
kR=Kurtosis from RGB value R
kG=Kurtosis from RGB value G
kB=Kurtosis from RGB value B
SkR=Skewness from RGB value R
SkG=Skewness from RGB value G
SkB-Skewness from RGB value B
What is the mean oneQ??

Sign in to comment.

Answers (0)


Find more on Agriculture in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!