%script write relate calculation wavelet by ebrahimi clear; clc; %Load data % load S01; % s = S01(1:16); is=xlsread('DARAN.xlsx',1, 'C2:C20'); os1=xlsread('DARAN.xlsx',1, 'D2:D20'); % os2=xlsread('DARAN.xlsx',1, 'B2:B361'); % os3=xlsread('DARAN.xlsx',1, 'B2:B361'); %load leleccum; %s = leleccum(1:4096); %s=sin(1:.0001:pi); lis = length(is); los1 = length(os1); % los2 = length(os2); % los3 = length(os3); %Plot signal and the 3rd level averaged signal [C,L] = wavedec(is,3,'haar'); bis = waverec(C,L,'haar'); A3 = wrcoef('a',C,L,'haar',3); D1 = wrcoef('d',C,L,'haar',1); D2 = wrcoef('d',C,L,'haar',2); D3 = wrcoef('d',C,L,'haar',3) ; inputs = A3'; %inputs = is'; targets = os1'; % Create a Fitting Network hiddenLayerSize = 10; net = fitnet(hiddenLayerSize); % Choose Input and Output Pre/Post-Processing Functions % For a list of all processing functions type: help nnprocess net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'}; net.outputs{2}.processFcns = {'removeconstantrows','mapminmax'}; % Setup Division of Data for Training, Validation, Testing % For a list of all data division functions type: help nndivide net.divideFcn = 'dividerand'; % Divide data randomly net.divideMode = 'sample'; % Divide up every sample net.divideParam.trainRatio = 70/100; net.divideParam.valRatio = 15/100; net.divideParam.testRatio = 15/100; % For help on training function 'trainlm' type: help trainlm % For a list of all training functions type: help nntrain net.trainFcn = 'trainlm'; % Levenberg-Marquardt % Choose a Performance Function % For a list of all performance functions type: help nnperformance net.performFcn = 'mse'; % Mean squared error % Choose Plot Functions % For a list of all plot functions type: help nnplot net.plotFcns = {'plotperform','plottrainstate','ploterrhist', ... 'plotregression', 'plotfit'}; % Train the Network [net,tr] = train(net,inputs,targets); % Test the Network outputs = net(inputs); errors = gsubtract(targets,outputs); performance = perform(net,targets,outputs) % Recalculate Training, Validation and Test Performance trainTargets = targets .* tr.trainMask{1}; valTargets = targets .* tr.valMask{1}; testTargets = targets .* tr.testMask{1}; trainPerformance = perform(net,trainTargets,outputs) valPerformance = perform(net,valTargets,outputs) testPerformance = perform(net,testTargets,outputs)