A little help with function answer
1 view (last 30 days)
Show older comments
Hi, Everyone.
Hope you all are doing great. I'm stranded in a problem. I'm working with an assignment where i'm taking partial derivative of a function and then the function returns the values but i'm not able to find how to use those values for further calculations for my program.
I'm pasting my code below. Any kind of help is much appreciated.
Regards: Tamur Ahmed
%% Functions for calculations
% defining system variables
syms weight1 weight2 input1 input2 bais
syms netInputOfLayer
syms desiredOutput1 desiredOutput2 obtainedOutput1 obtainedOutput2
%Fucntion to calculate Net Inputs of Layers
nets = @(weight1,weight2,input1,input2,bais) weight1*input1 + weight2*input2 + bais * 1;
%Fucntion to calculate Outputs of Layers
outs = @(netInputOfLayer) 1/(1+exp(-netInputOfLayer));
%Fucntion to calculate Total Error of Output Layers
tError = @(desiredOutput1, desiredOutput2, obtainedOutput1, obtainedOutput2)...
(1/2 *(desiredOutput1 - obtainedOutput1)^2) + (1/2 *(desiredOutput2 - obtainedOutput2)^2);
%Partial Derivatives
[E_totalAndouts] = @(pdwrt)...
(diff(tError(desiredOutput1, desiredOutput2, obtainedOutput1, obtainedOutput2),pdwrt));
[OutsAndnets] = @(pdwrt)(diff(outs(netInputOfLayer),pdwrt));
[NetsAndWs] = @(pdwrt)(diff(nets(weight1,weight2,input1,input2,bais),pdwrt));
I'm getting the output correctly but i don't know how to use this for further calculation.
0 Comments
Answers (0)
See Also
Categories
Find more on Numbers and Precision 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!