Não foi possível enviar o arquivo. Será algum problema com as permissões?
Diferenças
Aqui você vê as diferenças entre duas revisões dessa página.
| Ambos lados da revisão anterior Revisão anterior Próxima revisão | Revisão anterior | ||
|
disciplinas:ce709-2010:atividades [2010/10/20 18:08] walmes |
disciplinas:ce709-2010:atividades [2010/10/20 20:01] (atual) walmes |
||
|---|---|---|---|
| Linha 105: | Linha 105: | ||
| curve(opt$par[1]*x/(opt$par[2]+x), add=TRUE, col=3) | curve(opt$par[1]*x/(opt$par[2]+x), add=TRUE, col=3) | ||
| #----------------------------------------------------------- | #----------------------------------------------------------- | ||
| + | |||
| + | #------------------------------------------------------------------------------------------ | ||
| + | |||
| + | library(gWidgetsRGtk2) | ||
| + | |||
| + | da <- data.frame(x=1:20) | ||
| + | da$y <- 10*da$x/(3+da$x)+rnorm(da$x,0,0.2) | ||
| + | plot(y~x, data=da) | ||
| + | |||
| + | #------------------------------------------------------------------------------------------ | ||
| + | |||
| + | limits <- list(A=c(0,20), B=c(0,6), n=c(0,2)) | ||
| + | |||
| + | plotMM <- function(...){ | ||
| + | plot(y~x, data=da) | ||
| + | curve(svalue(A)*x^svalue(n)/(svalue(B)+x), add=TRUE) | ||
| + | } | ||
| + | |||
| + | w <- gwindow("Slider and spinbox example") | ||
| + | |||
| + | tbl = glayout(cont=w) | ||
| + | for(i in 1:length(limits)){ | ||
| + | tbl[i,1] <- paste("Slide to adjuste parameter", names(limits)[i]) | ||
| + | tbl[i,2, expand=TRUE] <- (assign(names(limits)[i], | ||
| + | gslider(from=limits[[i]][1], | ||
| + | to=limits[[i]][2], | ||
| + | by=diff(limits[[i]])/20, | ||
| + | value=mean(limits[[i]]), | ||
| + | container=tbl, handler=plotMM))) | ||
| + | } | ||
| + | |||
| + | plotMM() | ||
| + | |||
| + | #------------------------------------------------------------------------------------------ | ||
| </code> | </code> | ||