how to plot this function?

if true
% code
endfunction [finalW, MSE, Numiterations] = gradientDescentLinearNeuron(P, t, lr, ErrorGoal, MaxIterations)
FinalW=(2*rand(1,100)-1)/10;
x=(2*rand(1,100)-1)/10;
x(:);
ErrorGoal=0.15;
lr=0.1;
step=1;
while ((MSE>ErrorGoal)&&(step<=MaxIterations))
y1=FinalW*x;
si=size(FinalW);
y2=ones(si);
y=[y1,y2];
dMSEdw=-1/((length(x)*((sum(t)-y)*x)));
FinalW=FinalW-lr*dMSEdw;
MSE=1/2*(length(x)*((sum(t)-y).^2));
step=step+1;
end
end

3 Comments

P, t, lr, ErrorGoal, MaxIterations??
i get them from data lists. external lists.
function [finalW, MSE, Numiterations] = gradientDescentLinearNeuron(P, t, lr, ErrorGoal, MaxIterations)
FinalW=(2*rand(1,100)-1)/10;
x=(2*rand(1,100)-1)/10;
x(:);
ErrorGoal=0.15;
lr=0.1;
step=1;
while ((MSE>ErrorGoal)&&(step<=MaxIterations))
y1=FinalW*x;
si=size(FinalW);
y2=ones(si);
y=[y1,y2];
dMSEdw=-1/((length(x)*((sum(t)-y)*x)));
FinalW=FinalW-lr*dMSEdw;
MSE=1/2*(length(x)*((sum(t)-y).^2));
step=step+1;
end
end
What do you want to plot?
plot(Numiterations,finalW)
What is the error?

Answers (0)

This question is closed.

Products

Release

R2018b

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!