Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Ex15-12
# Gráfico em 3 dimensões # Curva t=seq(0,2.5,by=0.01) u<-function(s){s*cos(s)+2} v<-function(s){(-s^2)*sin(s)/4+1} curve(u,0,2.5) curve(v,0,2.5) plot(u(t),v(t),'l',col="red") # Superfície c=1 x <- seq(0,2.5, by=0.05) y <- seq(0,1,by=0.05) mf<-function(s,r){z=sqrt(s*r)*exp(-sqrt(s^3)/2-r^2)# f(x,y); auxiliar para gráfico z } plot(t,mf(u(t),v(t)),'l') require(grDevices) # for trans3d z <- outer(x, y, mf) z[is.na(z)] <- 4 op <- par(bg = "white") persp(x, y, z, theta = 60, phi = 20, expand = 0.5)->res lines(trans3d(u(t),v(t),mf(u(t),v(t)), res), col = "red", lwd = 2) # Inclui curvas hh=10^(-5) gradnf<-function(u){ # aproximação de f'(x,y) dfx=(mf(u[1]+hh,u[2])-mf(u[1]-hh,u[2]))/(2*hh) dfy=(mf(u[1],u[2]+hh)-mf(u[1],u[2]-hh))/(2*hh) c(dfx,dfy) } Y=matrix(0,2,length(t)) Y[,1]=c(2,1) h=0.1 for ( i in 1:(length(t)-1)){ Y[,i+1]=Y[,i]+h*gradnf(Y[,i]) } lines(trans3d(Y[1,],Y[2,],mf(Y[1,],Y[2,]), res), col = "blue", lwd = 2) # Inclui curvas plot(t,mf(Y[1,],Y[2,]),'l')
run
|
edit
|
history
|
help
0
26-08-2020AjusteCurva
lab1
Julia set variant 3
Integracao-Interpolacaa
2
Otavio-fez
Sentiment Analysis - using input field
19-08-2020-GaussSeidelSistema-menos-calc
Chi-squared tests of independence [m musculoskeletal injuries treated]
AjusteLinearizado