Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
26-08-2020Teste
# Minimo para resolver equação f(x)=0. x=seq(-5,5,by=0.5) n=length(x) erro=runif(n, min = -0.25, max = 0.25) fex<-function(s){20/(s^4+2*s+3)} f<-function(s,u){ a=u[1];b=u[2];c=u[3] s^2/(a*s^4+b*s+c) } y=fex(x)+erro g<-function(u){ p=0 for (i in 1:n){p=p+(y[i]-f(x[i],u))^2} p } gradng<-function(u){ h=0.00001 v=u; v[1]=u[1]+h dgx=(g(v)-g(u))/h v=u; v[2]=u[2]+h dgy=(g(v)-g(u))/h v=u; v[3]=u[3]+h dgz=(g(v)-g(u))/h c(dgx,dgy,dgz) } # Método de Euler ZeroEuler<-function(u0,t,n){ w=matrix(0,3,n+1) w[,1]=u0 h=t/n for (i in 1:n){w[,i+1]=w[,i]-h*gradng(w[,i])} w } # Teste u0=c(1,1,1); t=1; n=1000 g(u0) gradng(u0) u=ZeroEuler(u0,t,n) ; u [,n+1] # Aproximadamente u(100) g(u[,n+1])
run
|
edit
|
history
|
help
0
Grad-sistemac
Plot Graph By Adjacency Matrix
First wall
2
Gab1A(resumido)
Mathematical operations 1
histograms for survey stats and fats
code
Practical No 8
stats and fats survey histograms