# Gráfico em 3 dimensões

# Curva
t=seq(0,2.5,by=0.05)
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
}
require(grDevices) # for trans3d
z <- outer(x, y, mf)
z[is.na(z)] <- 4
op <- par(bg = "white")
persp(x, y, z, theta = -10, phi = 30, expand = 0.5)->res
lines(trans3d(u(t),v(t),mf(u(t),v(t)), res), col = "red", lwd = 2) # Inclui curvas

plot(t,mf(u(t),v(t)),'l')

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: